Welcome to WebmasterWorld Guest from 54.227.48.147

Forum Moderators: rogerd & travelin cat

Reducing Wordpress page generation time from 300-350 ms

     
10:58 am on Oct 20, 2017 (gmt 0)

New User

joined:Aug 22, 2017
posts: 33
votes: 2


Hi,

BACKGROUND

I have an NGINX+PHP7+wordpress-based news website with about 0.5 mln pvs a month.
Over time, with more and more plugins, the code's not as great as it used to be.
Moreover, with increasing traffic, the VPS is starting to slow down a bit.
I noticed that the WP Super Cache signature now says 'Dynamic page generated in 350 ms' (or 330 ms or 370 ms) in most cases.
For pages loaded directly from cache, the load time (of just the html file) is 100 ms from where I test, but for archives and the front page -- which are not cached -- the load time is 450-550 ms. The problem is that this can sometimes be as high as 1.25 seconds occasionally.

I thought the problem was with the VPS, and moved from a 1 GB, 1 core vps to a 2 GB 2 core vps. That didn't really help.
So I moved to a new host with a 3 GHz processor (vs 2.2 GHz on the earlier one) and PCI SSD memory etc. I chose a single core VPS as it didn't really seem to matter on the previous one.

Now, the proportion of pages that report 1 second page generation time or load times has fallen quite sharply, from about 5% to about 1%. But they're still there (and I can't sleep when they're still there

I tried to see if any particular plugin was behind the 300-350 ms page generation time shown by Super Cache, and I couldn't identify any of the 10 plugins I use as the culprit. I am assuming, they're all responsible in parts.

I remember, before the site became so complex, the page generation time used to be 100-130 ms. But I can't really make the site as plain as it used to be either, as the audience expects more.

DOUBTS

My questions are --

1) Is 300-450 ms 'too much' for generating the page (it's roughly the same for posts and archive pages)? Is there any 'acceptable' or benchmark value for this? How much does your website take?

2) Will increasing the core count and/or RAM help bring this down? I have already tried stripping away all the plugins I don't need, but they've not had much impact yet. Removing the Yuzo Related Posts plugin, perhaps, was the only one that resulted in some improvement, cutting the generation time by about 50-60 ms. But I need the plugin, so I reinstalled it.

3) If it's a core-count/RAM bottleneck, should I look at 'managed wordpress' solutions that may just be more cost-effective than going for a VPS with 4GB memory and 4 cores. (I am in Asia, and these things cost much more here. I don't want to host it in the US or EU because it adds about 1 second to the page load time from India - the target market. It's currently hosted in Singapore.)

4) Will moving to a 'real' Cloud-based server provider -- instead of KVM -- help deal with the outliers as far as page generation time is concerned ( the 1-second-and-above category)? If so, can anyone suggest a real cloud-based VPS or managed wordpress provider, preferably with easy access from Asia?
11:22 am on Oct 20, 2017 (gmt 0)

Full Member from CA 

Top Contributors Of The Month

joined:Feb 7, 2017
posts: 218
votes: 15


Have you analyzed your site using a web site speed test? There may be external sites that are being called that will slow down your load times. Look for a load chart of which sites are being called and see if there are any odd ones. This is especially bad for social media plugins, which can really slow down your site.

With Wordpress I have always found core is super fast, but plugins are its downfall.

As a suggestion, have you gone into myphpadmin and checked your WP tables? Maybe optimize them? Look for any extremely large tables, such as site stats tables, and cull them. They have, in the past, considerably slowed down my WP installs.
12:27 pm on Oct 20, 2017 (gmt 0)

New User

joined:Aug 22, 2017
posts: 33
votes: 2


Ok. I'll try that. It's a five-year-old install, and I've never looked into the db once.

As for JS etc, that doesn't come into the picture the way I test the site. I simply look at how much time it takes to generate the html code (rather than how much time the page actually takes to load in a browser after doing all the JS stuff.)

In this particular case, the page generation time is reported by Super Cache, which simply generates an HTML file without actually trying to load anything. So waterfall charts etc are of limited use in this case.

What I noticed is that when I move the site to a VPS with a 3.5 GHz processor, the pages that take 330 ms to be created take 290 ms only. The problem is that you can't really go beyond 3.5 GHz for now. There must be some other way to fix it. Anyway, I'll check the db once.
7:56 am on Oct 21, 2017 (gmt 0)

New User

joined:Aug 22, 2017
posts: 33
votes: 2


update -- managed to bring it down to 200-220 ms by doubling the cpu and RAM. Will stick with it for now. Thanks.
12:34 pm on Oct 21, 2017 (gmt 0)

Full Member from CA 

Top Contributors Of The Month

joined:Feb 7, 2017
posts: 218
votes: 15


How much cpu and RAM are you using?
9:09 am on Oct 22, 2017 (gmt 0)

New User

joined:Aug 22, 2017
posts: 33
votes: 2


when supercache is preloading, the server uses only about 40% of the cpus (2) and about 500 MB of ram (real use).

Btw, I managed to cut down the page generation time by a further 35-40% by moving to PHP 7.1 from 7.0 (actually I moved from 16.04 to 17.10).

I am actually testing 7.2 from the ppa as well, and I'll update on the results.
9:57 am on Oct 22, 2017 (gmt 0)

New User

joined:Aug 22, 2017
posts: 33
votes: 2


Here's the update on 7.2 (from the ppa). It does reduce page generation time by about 13%, but this was not uniform. In some cases (on some pages), page generation time actually increased a lot to about 1 second. Hence, disabled. Not worth it right now.

Btw, with 7.2, instead of 300-400 ms on a 1 GB 1 core server (original server), pages are now getting generated at around 160-170 ms, which is faster than the 220-250 ms on a 2 GB 2 core server using 7.0!
9:20 pm on Jan 2, 2018 (gmt 0)

Junior Member from CA 

Top Contributors Of The Month

joined:Mar 2, 2017
posts: 48
votes: 5


If that is the case I will try to use php 7.0 for one of my websites. I would be awesome to save a couple hundred ms.