0

I'm running a Wordpress ecommerce website on a dedicated VPS with 4CPUs and 6gb RAM, so resources are not an issue . On top of this I have VestaCP installed, with a Nginx + Apache + Php-FPM server . Also using clouflare caching together with WP Rocket, which have worked together the best out of all tests so far .

After deploying the website in question I have been struggling with unbearably high TTFB times which account for around 2.5seconds average from multiple locations I have tested using KeyCDN .

So I made a new fresh wordpress install and realized that even though my TTFB still isn't the best, I could reach around 400 to 500ms average from multiple locations .

This allowed me to rule out the possibility of having a bottleneck at the server side so after a bit more debugging and installing Wordpress Query Monitor, I realized the total number of calls being done to the database only accounts for 0.09 seconds, so the database also does not seem to be an issue unless it's causing a huge delay even before the first query after TTFB ends runs .

Another thing I have done was to disable every plugin but that also didn't seem to help much, perhaps it took 300ms or so to the total loading time during the wait (TTFB) .

I feel a bit lost here and at this point am not sure what else I could do in order to debug this or what might be causing it .

Even though the db queries are running fast it still feels as it's the database that hangs for a while before the website starts loading .

Would really appreciate some insights on how to further debug this issue and how to rule out the database as a bottleneck .

Thanks

  • Wipe the web server and rebuild it without VestaCP or any other control panel. – Michael Hampton Sep 26 '20 at 19:06
  • Michael thanks for the suggestion but I'm not aware of any issues with Vesta causing such abnormally high delays on the loading times . I will give it a try to rule out that possibility nevertheless ! – Optimus Servers Sep 26 '20 at 19:41
  • As suspected, a fresh install has no influence on the TTFB, which rules out any networking or server configuration issue . It's either mysql or php related – Optimus Servers Sep 26 '20 at 22:41
  • You haven't given enough information to diagnose this, and it would be difficult to provide that much information anyway. 400ms TTFB isn't bad, I just tested my website from US west to east and that's about what it was. If a fresh Wordpress install is 500ms and your fully deployed website is 2.5s then it must be something to do with the software. You might be best getting in a professional with experience in that software to help you. – Tim Sep 27 '20 at 03:43

2 Answers2

1

After multiple setups , tweakin caches, databases , CDN nothing work until I installed a Nginx + Php-FM + Redis Cache stack together with redis cache plugin for wordpress.

I have to say I am very impressed with the results and I don't think I have ever seen a woocommerce website with such a low TTFB .

TTFB went down from 2.5 sec to 60-120 ms !! Insane increase in performance :)

If you ever find yourself struggling with high TTFB for wordpress, give this setup a try, it's the best thing I have ever done for a wordpress website .

Furthermore, it doesn't need a cache plugin to work !

  • Indeed, the persistent object cache plugin (WP Redis, for example), is very beneficial. Here's a [complete guide](https://www.getpagespeed.com/web-apps/wordpress/speed-up-wordpress-with-persistent-object-cache-powered-by-latest-redis) for how to set it up, how it works, and what to expect from it. – Danila Vershinin Oct 25 '20 at 18:37
0

You can try calling all assets from the footer, optimizing images and activate lazy loading. I need to look at gtmetrix data to help me in more detail.

menderes
  • 31
  • 1
  • https://webpagetest.org/result/200927_3P_a5db3c19322165bebe7a2b8334d35e7c/1/details/#waterfall_view_step1 I also have installed New Relic but still unable to figure out what is happening before the website loading per se starts . Database has been optimized with mysqltuner and after installing the website in multiple servers it doesn't seem to be any issue related to database . Everything seems to point out in the direction of a theme / php issue but the woocommerce theme I am using is able to achieve 500ms TTFB on their demo page . GMetrix or any other wont help much here ... – Optimus Servers Sep 27 '20 at 04:24
  • I understand, when I check it seems your javascript files are uncompressed or you can compress more. Also free or CloudFlare etc in business plan There are many CDNs, web pages that offer Caching services. You can take advantage of it. There are many plugins that provide image optimization in Wordpress. – menderes Sep 27 '20 at 06:07
  • With these plugins you can optimize images and enable lazy loading. In this way, you will see a decrease in TTFB value. You should avoid using PNG, if possible, you should use WEBP. https://premium.wpmudev.org/blog/image-optimization-guide/ – menderes Sep 27 '20 at 06:07
  • Lazy loading has nothing to do with TTFB I think ? tTFB is everything happening after the DNS query and before anything at all starts loading ... So image compression , minification and all those have no influence on tTFB, just on the total loading time ... I am not concerned with what happens after first byte since that can be easily optimized further . – Optimus Servers Sep 27 '20 at 08:52
  • You're right, did you try and get CloudFlare out of the way? There is a wait for about 3 seconds on the server side. No packet loss appears in Traceroute and Ping. Can you check the CloudFlare settings? DDoS settings, WAF settings etc. – menderes Sep 27 '20 at 17:00