HTTP Keep Alive持续时间和TCP超时持续时间之间的关系 [英] Relation between HTTP Keep Alive duration and TCP timeout duration

查看:1576
本文介绍了HTTP Keep Alive持续时间和TCP超时持续时间之间的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图了解TCP / IP和HTTP超时值之间的关系。这两个超时值是不同还是相同?大多数Web服务器允许用户通过某些配置设置HTTP Keep Alive超时值。 Web服务器如何使用此值?这个值只是在底层的TCP / IP套接字上设置,即HTTP Keep Alive超时和TCP / IP Keep Alive Timeout是否相同?或者他们的处理方式不同?

I am trying to understand the relation between TCP/IP and HTTP timeout values. Are these two timeout values different or same? Most Web servers allow users to set the HTTP Keep Alive timeout value through some configuration. How is this value used by the Web servers? is this value just set on the underlying TCP/IP socket i.e is the HTTP Keep Alive timeout and TCP/IP Keep Alive Timeout same? or are they treated differently?

我的理解是(可能不正确):
Web服务器使用底层TCP套接字的默认超时(即无限期),无论如何已配置的HTTP Keep Alive超时,并创建一个计数器,该计数器线程将指定的HTTP超时间隔倒计时。当工作线程达到零时,它会关闭连接。

My understanding is (maybe incorrect): The Web server uses the default timeout on the underlying TCP socket (i.e. indefinite) regardless of the configured HTTP Keep Alive timeout and creates a Worker thread that counts down the specified HTTP timeout interval. When the Worker thread hits zero, it closes the connection.

编辑:
我的问题是关于它之间的关系或区别两个超时持续时间,即当HTTP保持活动超时持续时间和Web服务器使用的套接字(SO_TIMEOUT)上的超时不同时会发生什么?我是否应该担心这两个是否相同?

My question is about the relation or difference between the two timeout durations i.e. what will happen when HTTP keep-alive timeout duration and the timeout on the Socket (SO_TIMEOUT) which the Web server uses is different? should I even worry about these two being same or not?

推荐答案

它们是两个独立的机制;这个名字是巧合。

They're two separate mechanisms; the name is a coincidence.

HTTP keep-alive(也称为持久连接)保持TCP套接字打开,这样就可以在不设置新的情况下发出另一个请求连接。

HTTP keep-alive (also known as persistent connections) is keeping the TCP socket open so that another request can be made without setting up a new connection.

TCP keep-alive是一种定期检查,以确保连接仍然正常并正常运行。它通常用于确保NAT盒(例如,DSL路由器)不会忘记内部和外部ip /端口之间的映射。

TCP keep-alive is a periodic check to make sure that the connection is still up and functioning. It's often used to assure that a NAT box (e.g., a DSL router) doesn't "forget" the mapping between an internal and external ip/port.

这篇关于HTTP Keep Alive持续时间和TCP超时持续时间之间的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆