Improve ss4 live site speed

Hi,
I got a trouble with the live site.
We use apache 2 + mysql + ubuntu 20.04 LTS
But the site is quite slow, almost times, waiting time for server return response (first init page - doc request) is about 4-7s
Can some one help to give me some tips to trouble shoot this problem ?
Thank you so much!

Unfortunately, that’s a really open-ended question, and without a bit more information, it’s hard to give any meaningful advice.

In general terms:

  • Make sure your hosting is properly optimised, PHP is set up correctly, database server is configured properly, etc.
  • Make sure you’re using the latest versions of PHP, MySQL, Silverstripe, etc.
  • Ensure you don’t have a bunch of code / modules installed you’re not using
  • Use partial caching where appropriate to help reduce the amount of work that has to be done on each page load
  • Try and find the bottlenecks. You may have to use some debugging software to see what’s taking all the time. 4-7 seconds obviously isn’t right, so you need to find out what’s been added to make it slow. Could be some custom code, could be a module.
  • Check for obvious issues like loops nested inside others, queries inside loops, etc.

Beyond that, I’m afraid there’s not a lot more advice I can offer. You need to get into the custom code of the site and identify where the slowness is coming from. Once you’ve got that far, post the info here… there should be plenty of ways to optimise it and get things zipping along

1 Like

I would add:

  • pass to NGINX
  • use SSD disks
  • check the size of your assets (javascript, images)
  • check the response time of any remote services you are using (webfonts, external javascript, stats and anything else)

pingdom speed test and many other online tools can help you identify the bottleneck… and sometime that is not PHP related.

1 Like

I would install a fresh Silverstripe install, and check that it is faster, just to rule out server issues. If it is fast, then I’d take your site, and either use a debugging tool or just start removing bits, 50% at a time, to narrow down what’s causing it. e.g. Strip out your modules, test to rule out it being caused by a module, then start removing bit’s of your template, to hopefully get to the bottom of it.

1 Like

This is why i created GitHub - lekoala/silverstripe-debugbar: SilverStripe DebugBar module :slight_smile: it should help you pinpoint where the time is spent

3 Likes

If, after doing all that, you still need better performance, substitute redis for file system caching. In our most complex Silverstripe implementation, we use nginx, 6 pho-fpm servers, an NFS server, a redis server, and an opensearch server. We also use the queued jobs module to handle tasks that still take a long time.

1 Like

Thank you all. There are many nice ideas for trouble shooting.
It will take time but I will try and come back to you later when I got the cause
It still run fast on my local with docker, no optimizing but quite slow on VM on cloud
I think something not from code, something from how VM is set up