I would like to get to my site 100 score on google page speed and I only have the problem of TTFB in a few pages, a few pages in my TTFB is 400-600 ms.
Now I noticed a problem if I disable gzip compression, my site is under 200ms, and then passes the test of google page speed.
I have the problem of high TTFB with this configuration in my .htaccess:
[code]
Compress HTML, CSS, JavaScript, Text, XML and fonts
If you put a check for another module does it have the same issue? I’m wondering if it is the actual processing of the .htaccess file that is causing grief for some reason.
If you control the server, can you add the definition to the main http conf file instead of .htaccess to see if that changes things?
Is your site HTML code dynamically generated? If so could you try to save the HTML code as static file and test it again? The delay you see might be due to output buffering. When gzip is off your site might generate enough content to flush it to user and browser might start processing it early, which results in faster TTFB times. On the other hand if gzip is on and it takes a lot of time to generate “bottom” of HTML code it may slow down initial TTFB.
While the tests don’t give definite answer they are in line with what I wrote earlier (especially since TTFB of a static file is normal). Most probably the delay is caused by output buffering of content by gzip filter in Apache. Try to profile your script to see where the problem might be.