Terrible TTFB Times

To start with I know there are a ton of threads already on this forum concerning TTFB. I have been through all of them and gotten mixed results with some of the suggestions there.

my site is wikimotive.com it’s a Wordpress site with a customized theme. I have it running through Cloud Flare and I also have the plugin W3TC installed and optimized according to advice I found on this forum.

Unfortunately I’m still seeing TTFB times varying between .6 second and 3 seconds, previously it had been as high as 6 seconds. I’m not sure why these times vary so much either. I have all A’s for my performance test except for one B and the F for TTFB so this is the last thing holding me back.

Thanks in advance for your advice.

Unfortunately TTFB is largely a black box from the outside and the only way to get visibility into it is to instrument the app itself.

An F for 0.6 seconds is pretty safe to ignore. I have a thread about it somewhere here but the target time is calculated based on a multiple of the socket connect time (with that being used as an estimate for the round trip time to the server). With cloudflare the socket connect time is quite a bit shorter than the actual round trip time to the real server so the target gets set artificially low.

That said, the times where you see it > 1 second are cause for concern (even 0.6s is on the high end for a fast site but not bad for wordpress if you are on shared hosting).

If you are on dedicated hosting or a VPS and have dev skills, I HIGHLY recommend installng New Relic on the server. The pro offering is free for 2 weeks which should be long enough to find the hot spots (and then you can either pay to keep the pro level or let it degrade to a free account). It will pretty much tell you what the slow spots are right away.

If you are on shared hosting or don’t want to install a full APM solution you can install a plugin that will log the performance of various wordpress activities and it will tell you the slow spots. W3 total cache has a debugging option and there are others as wel (debug queries I think is one).

The root cause is likely going to be one or more of these:

  • Overloaded database + slow/many queries
  • External web services calls to other systems
  • Overloaded web server

I am on shared hosting with Rack Space using Cloud Sites. I’ve been kind of teaching myself dev skills for a while, mostly web stuff I know a decent amount of PHP from working with WordPress themes but as I understand working with a Linux server is a bit higher level. I’m willing to make a go at it I usually pick this stuff up pretty quick but if it’s going to be a steep learning curve I’m not sure if I want to pony up the extra money only to find out I’m completely butchering it.

It doesn’t seem to be the database any way the W3TC debugging is saying the total query time is .155 seconds. Overloaded web server would be fixed by getting a dedicated server I assume. I’ve noticed lagging with loading some social sharing buttons I have on the site but they usually load after all the content would that fall under external web service calls, and would that be getting in the way of TTFB?

TTFB is not influenced with anything that is pulled in by the browser (like the social buttons). By external web service, I meant one that is called directly by your web server (some spam prevention plugins may do this if they need to check with a central database).

I’m not sure which of Rack Space’s plans are covered but I know New Relic has a deal with them where you get some of their services for free (more than the typical free account) - http://newrelic.com/rackspace

Was the W3TC total query time of 0.155 seconds on a fast or a slow load? You can have WebPagetest record the response bodies (checkbox in the advanced settings) so you can get a correlated debug trace and test results.

It’s just weird I got a .09 on one that I had a 7sec TTFB, then I had one that had a 600ms TTFB and the database query was still .09 later there was one where I got a 9second TTFB and the database query was .6 here’s the link to my latest results they’ve been varying even more since my original post here. http://www.webpagetest.org/result/120723_W9_HJR/
run #2 was beautiful but the rest are pretty bad. Does it mean anything that the repeat views are always lightning fast between 200-300ms for full page load every time.

Looks like the page is just about 100% cacheable (including the html) so the repeat views are done almost entirely from the local disk on the test machine.

Doesn’t look like it is caused by database performance (at least from anything W3TC can see). Can you turn on the other debugging info?

It could be something in the Rackspace Cloud Sites dynamic scaling stuff but that would be pretty unfortunate.

It looks like you have Google Analytics on the site as well. You should go check the site speed report in your analytics dashboard (content->site speed->page timings->performance->server response time). That will give you a histogram of your server response times for the actual users visiting so you can see how it looks in the real world.

If W3TC’s debug information can’t provide any additional visibility I would recommend opening a ticked with Rackspace’s support department to have them take a look. That’s crazy-slow.

Average server response time is 3.44 seconds over the last week but again it ranges from 1 second to 5+ I can turn on raw logs through RackSpace but I’ve looked at those before and I don’t think it will help. I’m only really running the database and browser caching functions on W3TC and everything else is handled by CloudFlare I believe.

I’ve talked to the support people at rackspace before and they seem a bit clueless on the issue. They kept telling me to use WP Supercache but as far as I know W3TC is much better, and it seems to be working properly.

Yeah, W3TC does a superset of what Supercache does and it does appear to be working correctly. If you’re open to switching hosting, WordPress Hosting, Perfected. | WP Engine® is a performance-focused wordpress hosting provider. If support isn’t going to be able to help and the in-app logging is not showing the delays then you’re probably not going to have much choice (it is going to be on their side at that point).

FWIW, the server time (TTFB) is basically the one thing that cloudflare DOESN’T help with so turning on full logging may help but only if they are configured to log the server response times.

What are your thoughts on doing a dedicated server and learning how to manage the Linux server myself I actually just transferred from Godaddy to rackspace a little more than a month ago with probably 40ish domains I’d really rather not do that to myself again lol.

That is an option though you’d be responsible for backing up and failing over to a new server if the hardware dies so it’s quite a bit more involved than just managing linux. You’d also be responsible for securing the server and configuring all of the application-level stuff (Apache, MySQL, PHP, APC, etc). Getting them configured right to handle large volumes of traffic can be … challenging.

That said, you get a LOT more control. It’s just not for the faint of heart. If you can do a dedicated server with SSD’s then you’ll be in a much better position to have a fast server without having to do too much tuning to the apps themselves.

I moved from shared hosting to dedicated hosting for WebPagetest to be able to scale it much better and have been thrilled with the results but I built out the hardware myself and it does take a fair bit of day-to-day maintenence to keep the system going (and have had to deal with hack attacks, etc).