TTFB and Wordpress, again...
|
08-17-2012, 07:37 PM
Post: #1
|
|||
|
|||
TTFB and Wordpress, again...
Hi guys,
I'm one of those long TTFB on Wordpress guy. Here are two test results (the server is in London) : Dulles London I'm on a VPS (3gb RAM if this helps) I setup a CDN with MaxCDN and configured Cloudflare as well, both used in conjuction with W3TC. Every cache options are activated. After reading some posts in here, I deactivated all plugins I don't need, I deleted old post revisions. The output of W3TC in my website's code : PHP Code: <!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/ What's on thoughts on that please ? Do you thing it's hosting related ? Can I even do something about it ? Thanks[/quote] |
|||
08-17-2012, 11:24 PM
Post: #2
|
|||
|
|||
RE: TTFB and Wordpress, again...
Try loading the page in an incognito window or while not logged in. W3TC will disable a lot of the caching when you are logged in.
Since you are on a VPS, install APC and configure W3TC to use APC as the backing store for the cache. It will take some tuning to make sure you allocate enough space to APC but that will cache things in RAM which will be orders of magnitude faster than on disk. I'm a little surprised that W3TC isn't reporting any times. Usually it will tell you how long it took to generate the page. Try turning on some of the debug settings on the main page. That will let you log the performance of the individual database queries so you can see what the slower ones are and possibly add database indexes. Finally, MaxCDN and Cloudflare are redundant. Cloudflare includes a CDN for the static content as part of their offering. |
|||
08-18-2012, 01:21 AM
(This post was last modified: 08-18-2012 01:34 AM by Abdulghani.)
Post: #3
|
|||
|
|||
RE: TTFB and Wordpress, again...
Thanks a lot for your answer Patrick, thanks for your active support on this forum, and thanks overall for that great tool you brought us.
Concerning what follows, please keep in mind I've almost hit the limits of my technical knowledge ![]() About APC : I'll have my hosting provider install it for me. Since I could change datacenter very soon, I'll wait until it's done. My questions : 1 - is there something specific I need to ask my host regarding APC install and configuration ? Or is "can you please install APC?" meaningful enough ? 2 - APC will handle cache in RAM. Sounds great, but wouldnt that decrease the overal performance of the server ? 3 - I have websites targeting Europe, but US is becoming a priority so I may change server location. Considering I'll use a CDN anyway and the tests results above, would you say this is a move that'll bring noticeable results ? In other terms, will it decrease load times ? About MaxCDN and Cloudflare : Thanks for the heads up. I have to say I'm more disposed to trust you than some stories I read around the web, but there are quite a lot of articles about the benefit of using both : here, or here or here So to sum up, would you say using both is useless or even harmful ? Hope this makes not too many questions. |
|||
08-18-2012, 01:56 AM
Post: #4
|
|||
|
|||
RE: TTFB and Wordpress, again...
(08-18-2012 01:21 AM)Abdulghani Wrote: 1 - is there something specific I need to ask my host regarding APC install and configuration ? Or is "can you please install APC?" is meaningful enough ? You can say "please install APC" which will probably get you the defaults which is usually a shared 32MB of cache space - http://php.net/manual/en/apc.configuration.php APC will cache the compiled PHP opcode in there as well and it should improve your overall performance. Depending on how deep your site is you could also cache a bunch of the frequently-used database queries using it or full HTML pages (at least the main landing page) and still not use that much space. With 3GB available on the server, even a few hundred MB for APC would not be unreasonable if it offloads a lot of other processing. At the end of the day, caching is all about hiding slow operations and it doesn't actually speed them up (the original query that fills the cache) so you'll want to spend some time doing both. Quote:2 - APC will handle cache in RAM. Sounds great, but wouldnt that decrease the overal performance of the server ? It depends on what the RAM on the server is being used for and if caching in APC can offload some of that. If you get a lot of repeated database queries then it will likely be moving things from the database query cache into APC. Quote:3 - I have websites targeting Europe, but US is becoming a priority so I may change server location. Considering I'll use a CDN anyway and the tests results above, would you say this is a move that'll bring noticeable results ? In other terms, will it decrease load times ? Moving your hosting will shave at most around a half of a second from page load times. Optimally the only request that goes directly to your servers will be for the base page and everything else will come from the CDN. Figure 2 round-trips as the worst case for the base page (once for the connection and once for the request). From the US West coast to Europe is probably around 200ms (100ms to the US east coast). If you can make your actual HTML cacheable even for a short period for users that are not logged-in (even one minute if you want updates to show quickly, possibly much longer for actual article pages) then Cloudflare could even serve your content directly from the edge. If you are considering moving your hosting, I'd encourage you to check out WPEngine. They are very performance-focused Wordpress hosting and their infrastructure runs on SSD's. Just changing the storage technology can actually make all of your first-byte time performance issues go away without having to change anything else. Quote:About MaxCDN and Cloudflare : Thanks for the heads up. I have to say I'm more disposed to trust you than some stories I read around the web, but there are quite a lot of articles about the benefit of using both : Using both doesn't make any sense. At least the third article talks a bit about the rationale and that he was seeing slightly better speeds using MaxCDN as a CDN than from Cloudflare's CDN but I expect that is a snapshot in time and not reason enough for the added complexity. Both vendors have good global coverage and Europe/US is a no-brainer for CDN's anymore. One thing to watch out for is how well any of the CDN's perform with your specific content. I'm not sure what technology Cloudflare uses to store the static resources at the edge. I know MaxCDN uses SSD's and that could account for some difference. Given the number of files a CDN serves, you should expect that your static resources will not be in RAM on their servers and they will probably need to hit disk. Hitting spinning disks can add 5-10+ms per request over what a SSD can do so it is a great technology for a CDN, particularly if you have long-tail content. That said, it's possible Cloudflare also has really fast long-tail resource performance - I just don't know for sure and it could possibly explain the slight difference. |
|||
08-18-2012, 02:25 AM
(This post was last modified: 08-18-2012 02:29 AM by Abdulghani.)
Post: #5
|
|||
|
|||
RE: TTFB and Wordpress, again...
Thank again for the thorough answer. I'm afraid my lack of knowledge doesn't make it justice, but I'll try anyway :
Quote:APC will cache the compiled PHP opcode in there as well and it should improve your overall performance. Depending on how deep your site is you could also cache a bunch of the frequently-used database queries using it or full HTML pages (at least the main landing page) and still not use that much space. With 3GB available on the server, even a few hundred MB for APC would not be unreasonable if it offloads a lot of other processing. I just had my host install APC and asked them to allocate around 350MB to it. I'll try and configure W3TC accordingly, then I'll test again. Quote:Moving your hosting will shave at most around a half of a second from page load times. Optimally the only request that goes directly to your servers will be for the base page and everything else will come from the CDN. Figure 2 round-trips as the worst case for the base page (once for the connection and once for the request). From the US West coast to Europe is probably around 200ms (100ms to the US east coast). Fair enough. I won't go in the migration trouble for now. I understand this won't change the world and that my TTFB problem isn't location related. Quote:If you can make your actual HTML cacheable even for a short period for users that are not logged-in (even one minute if you want updates to show quickly, possibly much longer for actual article pages) then Cloudflare could even serve your content directly from the edge. I don't understand this : how can I do this ? Does it also work with MaxCDN ? Quote:If you are considering moving your hosting, I'd encourage you to check out WPEngine. They are very performance-focused Wordpress hosting and their infrastructure runs on SSD's. Just changing the storage technology can actually make all of your first-byte time performance issues go away without having to change anything else. Well that sounds good, but I can't afford 99$/month for those sites for now. Thanks for the tip though. Quote:Using both doesn't make any sense. At least the third article talks a bit about the rationale and that he was seeing slightly better speeds using MaxCDN as a CDN than from Cloudflare's CDN but I expect that is a snapshot in time and not reason enough for the added complexity. Both vendors have good global coverage and Europe/US is a no-brainer for CDN's anymore. Then I'll test use one after the other. I may even test Cloudfront. As for W3TC debug mode, do you see something unusual ? Code: <!-- W3 Total Cache: Minify debug info: Code: <!-- W3 Total Cache: CDN debug info: Code: <!-- W3 Total Cache: Object Cache debug info: Code: <!-- W3 Total Cache: Page cache debug info: |
|||
08-18-2012, 03:13 AM
Post: #6
|
|||
|
|||
RE: TTFB and Wordpress, again...
Hmm, looking at the debug info, it looks like the database and object query performance are quite reasonable (taking ~80ms for each). I tried looking myself and the page took 4 seconds to come back but only 160ms of that was accounted for in the W3TC recorded time (I don't see the overall time logged).
in your example you have 1.8 seconds recorded as the page generation time (I don't see that comment in the HTML right now) and less than 100ms spent on the parts that W3TC would even cache so there is something else pretty expensive going on. You can try this to see if it can narrow it down to a single plugin: http://wordpress.org/extend/plugins/p3-profiler/ but short of spending a lot of time instrumenting the actual app I think New Relic (or something like it) is going to be needed to tell you what the slow parts are. It's also possible that there are server configuration issue contributing to the time but it's hard to tell from the outside. There's a lot of "missing" time so you'd have to figure out where it is being spent. |
|||
08-18-2012, 06:50 AM
Post: #7
|
|||
|
|||
RE: TTFB and Wordpress, again...
I just come back from a disaster after switching to DSO as PHP handler to be able to install APC. I'll keep you updated when I test it.
|
|||
08-18-2012, 07:25 AM
Post: #8
|
|||
|
|||
RE: TTFB and Wordpress, again...
I think TTFB on WordPress has so much to do with server performance (CPU & HDD speed). I checked that on my VPS with PHP-FPM, every page load gives me ~20% of CPU usage.
When I disabled page compression (gzip) on PHP level (php.ini & W3TC) and leave page compression on web server (NGINX) only, cpu usage down to ~10-15% on every page load. I can see that TTFB and "Waiting.." time decreased after that. |
|||
08-18-2012, 10:17 PM
(This post was last modified: 08-18-2012 10:18 PM by Abdulghani.)
Post: #9
|
|||
|
|||
RE: TTFB and Wordpress, again...
Hi,
so I've been tested a few configurations, with Cloudflare only, MaxCDN only, and the conclusion I come to is that I'm lost. For some locations, I get better results with one or the other, but I guess it comes down their pops. I wasn't able to find a configuration that works pretty much everywhere though. I'm using Cloudflare right now since I'm not inspired enough to make more tests and this solution seems to be working pretty good for now. As for TTFB, it varies, it doesn't go as long as it used to, but it's still unstable. I get between 0.5 anda bit more than 1 sec. 3 plugins installed. I guess I have to check with New Relic if I want to go further. A few tests results : 1.9 sec - Asheville 2.2 sec - LA 0.6 sec ? - NYC - Pingdom tools I get A grade in Yslow, and 99 in Google Page Speed. I guess I should be satisfied about that. I just hope something weird doesn't happen for the ones that count, meaning users. Anyway, thanks for your help Patrick. |
|||
08-23-2012, 08:29 AM
Post: #10
|
|||
|
|||
RE: TTFB and Wordpress, again...
Just wanted to mention that APC really only comes of age when running PHP in fpm mode, where it can hold a single cache across all working threads. Using it in memory mapped mode works better too, and there's less system stuff necessary to get >32MB storage working. eAccelerator ( despite seeming to be a dormant project ) seems to work better in the standard mod_php Apache environment.
As you may guess, I'm an nginx convert (: |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)