Tuesday, October 12, 2010

Time to first byte (TTFB) is the time it takes for a browser to start receiving information after it has start to make the request to the server. In some situations, as much as 75% of the time spent loading a page can be taken up by waiting for the first byte of data to arrive. You can test your time to first byte by using something like Byte Check or Load Impact
There are a few factors that come into play with TTFB, such as the network you are on and the server that your website is hosted on. The only thing that is controllable is the server you are on.
Optimise Your Database
This is both in a database size sense, and using the “optimise tables” sense. If you are using WordPress you can use one of the database optimising plug ins to remove your old posts. If you have a mySQL database that is over 10MB, then your server is going to spend a few milliseconds crawling through the tables to find the right data. The smaller you can make it the better.
Once you have reduced the overall size of your database, you can then optimise the tables, which will reduce any overhead you might have.
Take note of the host you are with
Even if you are using a CDN, your host will have an impact on your time to first byte. We ran a test on 4 identical websites using 4 different web hosts based here in Australia, and we found there was about a 20% difference in time to first byte depending on the server you are on. Sometimes it is both impractical and too costly to move to a new hosting provider, however it is something you need to look at next time you are in the market for a host.
Use Amazon Cloud Space
Using a Content Delivery Network is worth your while because not only can it reduce the bandwidth burden on your current host, but it can improve the speed of your website by a huge amount. You can self host as a CDN, but it won’t reduce your burden, it won’t change the TTFB, and it might only reduce your overall website speed by 10%.
We started out using the normal Amazon S3, but we actually found it to have a slower load time than our own server. However when we switched to Amazon Cloud Space, we went from an overall  TTFB of 4 seconds to 1 second. That is a 75% reduction in load time just by using the Cloud Space.

No comments:

Post a Comment