pagespeed insights 工具中提及的往返次数 google 是什么?

What are the round-trips google mentions in the pagespeed insights tool?

Google 表示它必须进行 5 次网络往返,并且在前 3 次往返之后只能查看首屏内容的 18%。

我该如何改进?

谢谢。

Pagespeed 的文档中,这个术语在不同的上下文中多次使用,确实有点令人困惑

网络往返

来自wikipedia

In telecommunications, the round-trip delay time (RTD) or round-trip time (RTT) is the length of time it takes for a signal to be sent plus the length of time it takes for an acknowledgement of that signal to be received.

所以更多的是关于TCP协议。来自 docs:

If the amount of data required exceeds the initial congestion window (typically 14.6kB compressed), it will require additional round trips between your server and the user’s browser. For users on networks with high latencies such as mobile networks this can cause significant delays to page loading

来自同一页面的 2 个食谱:

To make pages load faster, limit the size of the data (HTML markup, images, CSS, JavaScript) that is needed to render the above-the-fold content of your page

Structure your HTML to load the critical, above-the-fold content first

首屏内容是无需滚动即可看到的屏幕

有关 mobile 分析和 3 次往返的更多详细信息

Due to this TCP behavior, it is important to optimize your content to minimize the number of roundtrips required to deliver the necessary data to perform the first render of the page. Ideally, the ATF content should fit under 98KB - this allows the browser to paint the page after just three roundtrips to have plenty time budget for server response latency and client rendering.

阻止往返

来自另一个文档 page:

This section describes the round trips required to load the page’s render-blocking resources, the total bytes used by the page, and how it compares to the median number of round trips and bytes used in the dataset. It can indicate if the page might be faster by modifying the appearance and functionality of the page.

不清楚这是否意味着 网络往返 如上计算或只是加载阻塞资源所需的额外调用。

在任何情况下,您都可以通过消除同步 javascript 调用等渲染阻塞资源来修复它(更多 here