Waiting (idle) TTFB is 10s+ on some pages initial load

My time to first byte is 10s plus on one of my pages after clearing all cache. Other pages are 3 to 5 seconds. This is only on initial page load after a cache clear (all).

This happens whether in production or on the server. All Grav cache is enabled and performance once the pages are cached is outstanding. I’ve gone through all the plugins and eliminated any code and/or external loads I could think of.

According to chrome, the HTML document waiting time is the culprit.

I know this behavior is odd because I have a few other Grav sites with zero issues. Anyone know of where I can start tracking?

If you are using the relatedpages plugin, make sure it’s updated to the latest. There was a bug in this that caused every page to be processed on first page load. This combined with pages that have many images used can cause delays.

Also how many pages are you using? And what plugins exactly? Also are your images very large causing resizing to be very slow?

Thanks for the reply!

I have been doing some image optimization and have got my problem page down to about 5 seconds for initial load. I still feel like this is too slow though, considering all other pages – including many with more content – load in about 2-3 seconds after clearing cache.

For number of pages, I have about ten, plus a collection of about 229 blog/podcast pages, but these load really fast.

My installed plugins are minimal, admin, advanced page cache, email, error, feed, form, googlemaps, login, pagination, problems, simplesearch, sitemap and taxonomy list. I’ve toggled them all off and still have the issue.

Images are optimized for the most part, with the largest on my problem page coming in at 76k and only 5 other images that are less than that.

I feel 2 - 3 seconds on first load is okay/acceptable, but 5 seems really high for my site. The only thing i can think of that may be an issue is hosting the podcast audio on my server. The full s ite weight with those files is over 4gb, but I’m no really doing anything with them to cause any strain on the page giving me the slow load issue. Plus they load really fast. Any thoughts?

It could well be the advanced page cache plugin. Typically this precaches all the pages by calling their content() method using the onShutdown() event. This event runs after the page is done processing, however, there are certain server configurations where onShutdown() doesn’t work properly and page is not sent until the even finishes.

Try disabling this plugin to see if that makes a difference.

I think that helped some. Down to 4.62 seconds. Here is what concerns me:

Screen Shot 2016-07-30 at 4

Render is what is taking the majority of the time. Here is what chrome shows:

Screen Shot 2016-07-30 at 4

Again, this is only on first load after clear cache. Refreshes are super fast.

If you like you can PM me a zip of your site (minus any huge audio files), and I can take a look to see if I can find anything that stands out.

I will do that. I just started pulling it together and stripped out my audio files but somehow I am still 450mb!!! Needless to say, I am going to see where the large files are. This may very well lead me to the answer.

Be sure to share your results, many of us are always looking for ways to reduce load-speed on uncached sites.

@rhukster I PM’d you the zip file. Let me know if you didn’t get it for some reason.

Thanks i’ll take a look

i’m assuming the file in question was theRiver_DL.zip? The gitter messaging layout is a bit of a mess in that it doesn’t break out new messages with dates, it just tacks it on any previous message.

Anyway, i extracted this and tested on my local, and that thing is fast!

The first load took 1.1secs to cache (very acceptable) and then 20ms for the cached page.

Now I am running PHP7 which can make a HUGE difference. I would suggest checking the PHP version on your host.

I think at this point your host probably is the issue. If you are not seeing these kinds of times, then you might want to look at hosting somewhere else. A VPS solution is cheap and can provide awesome performance (better than what I even see on local). Check out our hosting section of the learn docs.

The messages are a little messy, which is why I alerted you here as well. Anyhow…

Thank you for taking the time to look. That is a relief to hear. I will look into VPS solutions once I take this one live. My test server is a dirt cheap shared hosting server so I am sure that makes all the difference. Plus I think I’m on PHP version 5.6. I know I can switch it to 7, just have to test other sites on that server with 7 first.

I think the bottleneck on my local environment was JSlint of the combined JS file registering a ton of errors (I’ve turned that off for development). I use Codekit for Mac to do this, compile sass, autoprefix, etc.