且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何减少等待时间(ttfb)

更新时间:2022-03-04 08:47:33

TTFB不是响应正文(即有用数据,例如json,xml等)的第一个字节的时间,而是从服务器接收到响应的第一个字节的时间.该字节是响应头的开头.

The TTFB is not the time to first byte of the body of the response (i.e., the useful data, such as: json, xml, etc.), but rather the time to first byte of the response received from the server. This byte is the start of the response headers.

例如,如果服务器在进行艰苦的工作之前先发送标头(例如繁重的SQL),您将获得一个非常低的TTFB,但这不是"true".

For example, if the server sends the headers before doing the hard work (like heavy SQL), you will get a very low TTFB, but it isn't "true".

在您的情况下,TTFB表示您在服务器上处理数据所花费的时间.

In your case, TTFB represents the time you spend processing data on the server.

要减少TTFB,您需要更快地完成服务器端的工作.