For those who are awake!
Discount -15%
We use cookies
We use cookies to optimize our website. By continuing to browse the site, you agree to our use of cookies.
New design
Control panel
  • Русский
  • Українська
  • English
  • UAH
  • USD
  • RUB
  • EUR
  • 0-800-307-307 Hotline
  • +38 (044) 392-74-33 Kiev
  • +38 (057) 728-39-00 Kharkiv
  • +38 (056) 794-38-31 Dnipro
  • +38 (032) 229-58-93 Lviv
  • +38 (048) 738-57-70 Odessa
  • +38(093) 170-15-42  Life
  • +38 (067) 400-88-44 Kievstar
  • +1(888)393-24-51  USA, Toll free
  • +44(131)507-01-14  Great Britain
  • +7 (499) 348-28-61 Moscow

2.19.2. Server response time (TTFB)

Server response time (TTFB - Time To First Byte) - the time until the first byte (network packet) of the site page is received after the request is sent from the client (for example, from the browser).

This is a complex metric, primarily depending on what operations are performed on the server while the request is being processed. Long response times can be attributed to dozens of factors: application logic, slow database operation, routing, software platform, libraries, lack of processor power or memory.

To check that the reason for the increased server response time is the internal processes of the site (scripts, database queries), and not general problems with the server, the easiest and fastest way is to use the most primitive PHP script, for example, displaying results phpinfo.

If you first measure TTFB for a request that assumes the participation of site scripts (usually the main page of the site if it is dynamic), and then TTFB for a request to a primitive script, then the difference between the results obtained will approximately show the net running time of the scripts.

You can make sure that the database itself also works quickly by executing primitive queries to it, or at least simply by checking the opening time of any tables through phpMyAdmin.

To reduce the server response time, the site developer (or an involved third-party specialized specialist) should independently analyze the operations performed on the site when processing requests and explore the possibility of their optimization.

The most direct approach is to log scripts. That is, in the scripts that are executed every time the site is loaded, put down breakpoints in which to mark the time it took to process a particular piece of code. Examples of outputting the processing time of the script can be found in open sources on the network (for example, here).

If there are delays associated with database queries, you should:

  • Check availability slow queries and if any are present, take steps to optimization.
  • Try to identify the most difficult queries and optimize them by analogy with instruction.
  • Analyze the structure of the database itself and, if necessary, carry out work on its optimization by analogy with instruction.

On the hosting side, the following tools can help reduce server response time to some extent:

  1. PHP version change to a newer one, if the site code is compatible with it (the effect of the transition from PHP 5 to PHP 7 can be especially noticeable).
  2. Connection and configuration of additional services OPcache (caching the compiled byte-code of scripts in RAM, no special support from the site is required).
  3. Connection and configuration of additional services Memcache(d) or Redis (caching arbitrary data in RAM, requires support from the site).