Time to first byte

Short description: Measure of web server responsiveness

"TTFB" redirects here. For the chemical, see TTFB (chemical).

Time to first byte (TTFB) is a measurement used as an indication of the responsiveness of a webserver or other network resource.

TTFB measures the duration from the user or client making an HTTP request to the first byte of the page being received by the client's browser. This time is made up of the socket connection time, the time taken to send and the time taken to get the first byte of the page.[1] Although sometimes misunderstood as a post-DNS calculation, the original calculation of TTFB in networking always includes network latency in measuring the time it takes for a resource to begin loading.[2] Often, a smaller (faster) TTFB size is seen as a benchmark of a well-configured server application. For example, a lower time to first byte could point to fewer dynamic calculations being performed by the webserver, although this is often due to caching at either the DNS, server, or application level.[1] More commonly, a very low TTFB is observed with statically served web pages, while larger TTFB is often seen with larger, dynamic data requests being pulled from a database.[3]

## Contents

* 1 Uses in web development
* 2 Importance
* 3 TTFB vs load time
* 4 References

## Uses in web development

Time to first byte is important to a webpage since it indicates pages that load slowly due to server-side calculations that might be better served as client-side scripting. Often this includes simple scripts and calculations like transitioning images that are not gifs and are transitioned using JavaScript to modify their transparency levels. This can often speed up a website by downloading multiple smaller images through sockets instead of one large image. However this technique is more intensive on the client's computer and on older PCs can slow the webpage down when actually rendering.

## Importance

TTFB is often used by web search engines like Google and Yahoo to improve search rankings since a website will respond to the request faster and be usable before other websites would be able to.[4] There are downsides to this metric since a web-server can send only the first part of the header before the content is even ready to send to reduce their TTFB. While this may seem deceptive it can be used to inform the user that the webserver is in fact active and will respond with content shortly. There are several reasons why this deception is useful, including that it causes a persistent connection to be created, which results in fewer retry attempts from a browser or user since it has already received a connection and is now preparing for the content download.[5]

## TTFB vs load time

Load time is how long it takes for a webpage to be loaded and usable by a browser. Often in web page delivery a page is compressed in the Gzip format to make the size of the download smaller.[5] This practice prevents the first byte from being sent until the compression is complete and increases the TTFB significantly. TTFB can go from 100–200 ms to 1000–20000 ms, but the page will load much faster and be ready for the user in a much smaller amount of time. Many websites see a common 5–10× increase in TTFB but a much faster browser response time garnering 20% load-time decrease.

## References

1. ↑ 1.0 1.1 Wagner, Jeremy (2016-12-22) (in en). Web Performance in Action: Building Fast Web Pages. Simon and Schuster. ISBN 978-1-63835-376-8. https://books.google.com/books?id=GzkzEAAAQBAJ.
2. ↑ Tu, Kenneth; Hasan, Jeffrey (2008-01-01) (in en). Performance Tuning and Optimizing ASP.NET Applications. Apress. ISBN 978-1-4302-0758-0. https://books.google.com/books?id=lIaNeH8gHb0C&pg=PA255.
3. ↑ Artasanchez, Alberto (2021-02-19) (in en). AWS for Solutions Architects: Design your cloud infrastructure by implementing DevOps, containers, and Amazon Web Services. Packt Publishing Ltd. ISBN 978-1-78953-914-1. https://books.google.com/books?id=4vAWEAAAQBAJ&pg=PA82.
4. ↑ Silhavy, Radek (2022-08-22) (in en). Software Engineering Perspectives in Systems: Proceedings of 11th Computer Science On-line Conference 2022, Vol. 1. Springer Nature. ISBN 978-3-031-09070-7. https://books.google.com/books?id=b4d8EAAAQBAJ&pg=PA626.
5. ↑ 5.0 5.1 Panigrahi, Bijaya Ketan; Trivedi, Munesh C.; Mishra, Krishn K.; Tiwari, Shailesh; Singh, Pradeep Kumar (2018-07-11) (in en). Smart Innovations in Communication and Computational Sciences: Proceedings of ICSICCS 2017, Volume 2. Springer. ISBN 978-981-10-8971-8. https://books.google.com/books?id=TtNjDwAAQBAJ.

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Time to first byte. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Time_to_first_byte&oldid=4154743"