0

On an all default Ubuntu 16.04 Nginx environment hosted on a 20$ DigitalOcean droplet I have only one WordPress site with a small amount of data: About 10 webpages, 10 images (around 100kb each), and 6 common plugins (all in default configuration).

I experience a bit of a slow general loading time (TTFB), in this site.

Configuration files

WordPress caching (AutoPtimize):

enter image description here

OpCode caching:

enter image description here

My problem

Since I uploaded the site, about a month and half ago, I keep getting the following error, in each Google PageSpeed Insights test (GPI):

Reduce server response time

In our test, your server responded in 0.95 seconds. There are many factors that can slow down your server response time. Please read our recommendations to learn how you can monitor and measure where your server is spending the most time.

It's always 0.93 to 1.20 although I feel, intuitively, that it should have been much lower than that, per the data I've given.

Why WordPress isn't the problem

  1. The site's theme is Astra, without a subtheme. The same problem happened with other themes as well.

  2. I have enabled CSS-JS minification, resource compression and WordPress caching with the plugin AutoPtimize as well as Nginx caching (see below).

  3. I tried to turn off all plugins, yet no serious change was seen; I went down from 900ms to around 450ms while still having the error.

  4. Everything is totally up to date with automatic upgrades coming from the CLI (unattnded-upgrades and WP-CLI).

My question

Given that all my tests indicate that this is an Nginx/PHP problem, what do I lack in my Nginx/PHP configuration to have a much lower loading time (say up to 0.10)? Everything is default for both, so I can't say what will be bad in that.

Update

Activating the free plan of Cloudflare with full (strict) SSL processing, didn't bring any TTFB significant change.

  • "Why WordPress isn't the problem" - The only way to really confirm that is to serve a static HTML page (outside of WordPress). – MrWhite Apr 7 '18 at 13:00
  • I'm not sure you're right: I'm going to use WordPress either way - if there's an architectural problem in WordPress, I won't change WordPress. From my POV, WordPress is just fine. – user9303970 Apr 7 '18 at 14:21
  • 1
    Avoid deleting and reposting questions. This causes people who follow your question to lose track of it. Instead, edit your existing question to bump it to the home page. – Michael Hampton Apr 7 '18 at 16:16
  • If your site has mostly anonymous users, Nginx page caching can give you a massive speed up. – Tim Apr 8 '18 at 6:29
  • Are you sure your site uses any full page caching technique using a plugin or some other way? – Pothi Kalimuthu Apr 10 '18 at 4:06
1

Autoptimize is the main problem here when achieving better TTFB, other factors contribute, but Autoptimize makes TTFB equal to the page generation time by design.

It uses output buffers to scoop up everything output to the browser, intercepting it and storing it. Then, once the page has finished generating, it processes the page output to concatenate CSS and JS, and spits all the bytes out at once at the very end.

I strongly recommend uninstalling it. If you want performance gains, use an object cache coupled with something like memcached or redis. This will take the form of a wp-content/object-cache.php and enabling WP_CACHE in your wp-config.php, coupled with installing and configuring memcached or equivalent. This will give you a significant boost to site performance in pretty much all areas

If you don't uninstall it, then your options are severely limited. By design, TTFB will always be equal to page generation time + however long Autoptimize takes. You also lose all the performance benefits of HTTP/2.

Thus the only way to reduce TTFB with this plugin installed, is to improve page generation time in PHP. This could be via object caches, refactoring DB queries, upgrading PHP, but if your page loading time is already low then there's little to be done.

My recommendation would be to look into and research alternative methods of resolving the google page speed score with regards to stylesheets and scripts, and try to improve page generation speed. Those solutions will improve your site performance, even with Autoptimize activated

  • Hi Tom. I must tell you, via AutoPtimize I took care of all the many Google PageSpeed Insights errors of "Eliminate render blocking CSS and JS". It might be worth for me to keep AutoPtimize but install Memcache or Redis (or it will be totally illogical and Memcache/Redis will be just ineffective because of AutoPtimize)? – user9303970 Apr 8 '18 at 6:55
  • 2
    @user9303970 The proper way to fix that error is to fix the broken theme and/or plugins. Using something like AutoPtimize is a bad workaround at best. – Michael Hampton Apr 8 '18 at 14:15
  • No, uninstall AutoPtimize, your TTFB will never be good with it installed because of how it works. And yes, install an object cache, it's the single greatest thing you could do outside of upgrading PHP and removing post meta queries to improve site performance. Note though that AutoPtimize will give inferior results though, most of the performance gains from newer RFCs regarding HTTP/2 are nullified because of the way AutoPtimize works. Do not rely on a WP plugin to fix your JS and CSS, do that yourself – Tom J Nowell Apr 8 '18 at 15:41
  • I don't create themes, I'm not a themer; I must rely on outer themes and plugins to best serve their CSS. The themes I use barely has any JS. It's mostly CSS. – user9303970 Apr 8 '18 at 18:05
  • Also, JS problems in small, minimal themes are usually minor / do not justify any changes, from my experience. – user9303970 Apr 8 '18 at 18:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.