I recently changed the host of one of my websites, and I noted that pages are loading slowly. The elements of the page themselves are quickly loaded (the pages are lightweight, CSS and JS are minified, GZIP is on, JPEG are compressed...), but the time to connect to the site seems very high.
So I ran a benchmark to analyse my website. It turns out that the "time to first byte" is extremely high, and I assume this is what I witnessed (the grey spinner on Google Chrome is spinning too much compared to other websites).
The test is available here: http://cl.ly/image/213Z3I1o0p37
I also witnessed this phenomenon on other websites on the same servers. It's not my Internet connection because it occurred in different places, with high speed connections.
So my question is: what could cause this high "time to first byte"? Should I look into the Apache config, or PHP..?
Can the fact that the DNS servers and the websites are hosted by two different companies respectively affect this time to first load?
Additional informations:
- Shared hosting
- Apache 2.2
- CentOS 6
- Intel Core i5-3570 CPU @ 3.40GHz / RAM 16 Gb
Edit: I ran 2 tests on simple PHP files -- just a phpinfo().
Test 1 DNS: hosted by company A Website: hosted by company B Test result: http://cl.ly/image/1T181a452T2R
Test 2 DNS: hosted by company B Website: hosted by company B Test result: http://cl.ly/image/0Z262k2F2M2c
The second test shows that it is faster, and I don't understand why. The tests are the same, the code are the same. But the first one has a high time to first byte... Any idea why?