gpt4 book ai didi

windows - 使用网络面板进行分析时,强制 Chrome 关闭/重新打开所有 TCP/TLS 连接

转载 作者:可可西里 更新时间:2023-11-01 02:30:36 25 4
gpt4 key购买 nike

Chrome DevTools 的网络面板非常适合查看不同请求的加载时间。它分析了每个请求和 reports how long different parts of the request took, including the time spent making the initial TCP connection and SSL handshake :


(来源:google.com)

当我第一次加载页面时,我看到了初始连接和 SSL 握手所花费的时间。 如果我立即重新加载页面,我将不再看到任何花在初始连接和 SSL 握手上的时间。我认为这是因为 Chrome 已保持打开来自先前请求的 TCP 连接并正在重新使用它.这对于正常浏览来说非常好,但它使得分析初始页面加载变得困难。

有什么方法可以强制 Chrome 不重复使用任何现有的 TCP/TLS 连接并始终建立新连接?

如果不是在 Chrome 中,我可以在操作系统级别做些什么来实现这个目标吗?我在 Windows 上,如果它有所作为的话。

最佳答案

Chrome checks its socket pools to see if there is an available socket for the hostname, which it may be able to reuse - keep-alive sockets are kept in the pool for some period of time, to avoid the TCP handshake and slow-start penalties. If no socket is available, then it can initiate the TCP handshake, and place it in the pool. Then, when the user initiates the navigation, the HTTP request can be dispatched immediately. -- High Performance Networking in Google Chrome

导航到 chrome://net-internals#sockets 以查看事件套接字。如果您点击“关闭空闲套接字”,下次刷新页面时,它将建立一个新连接。

我不确定是否有办法告诉 Chrome 禁用 Connection: keep-alive header ,但我认为您可以使用像 Modify Headers for Google Chrome 这样的 Chrome 扩展程序拦截从客户端发送的 header 并在请求到达服务器之前将其删除。

关于windows - 使用网络面板进行分析时,强制 Chrome 关闭/重新打开所有 TCP/TLS 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37170812/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com