“connectionTimeout"到底是什么意思?在Tomcat中是什么意思?
在文档(Tomcat 7 配置)中,它是这样写的:
In the docs (Tomcat 7 Config), it is written:
在接受连接后,此连接器将等待显示请求 URI 行的毫秒数.使用值 -1 表示没有(即无限)超时.默认值为 60000(即 60 秒),但请注意,Tomcat 附带的标准 server.xml 将其设置为 20000(即 20 秒).除非 disableUploadTimeout 设置为 false,否则在读取请求正文(如果有)时也会使用此超时.
The number of milliseconds this Connector will wait, after accepting a connection, for the request URI line to be presented. Use a value of -1 to indicate no (i.e. infinite) timeout. The default value is 60000 (i.e. 60 seconds) but note that the standard server.xml that ships with Tomcat sets this to 20000 (i.e. 20 seconds). Unless disableUploadTimeout is set to false, this timeout will also be used when reading the request body (if any).
当客户端向服务器发送请求时,建立连接需要 N 毫秒.如果这个 N 超过了客户端设置的连接超时时间,则客户端中的请求会按预期失败.
When a client sends request to a server, it will take N milliseconds to establish a connection. If this N exceeds the connection timeout that is set on the client's end, the request will fail in the client as expected.
我无法理解 Tomcat 的 connectionTimeout
的不同之处.具体来说,接受连接后,显示请求URI行"是什么意思?
I'm not able to understand what Tomcat's connectionTimeout
does differently. Specifically, what does "after accepting a connection, for the request URI line to be presented" means ?
推荐答案
connectionTimeout
是服务器将自动关闭与客户端的连接的时间限制,而不是相反.这是一种限制拒绝服务攻击影响的方法.实际上,进行 DOS 攻击 的典型方法是在给定服务器上启动多个请求,每个请求将永远持续,使服务器无所事事并填满其线程池,从而使服务器获胜'不能接受任何新的请求.由于此超时,x 毫秒后它将忽略该请求,将其视为潜在攻击.
The connectionTimeout
is the limit of time after which the server will automatically close the connection with the client not the other way around. It is a way to limit the impact of a Denial Of Service Attack. Indeed a typical way to do a DOS Attack is to launch several requests on a given server, and each request will last forever making the server waits for nothing and filling up its pool of threads such that the Server won't be able to accept any new requests. Thanks to this timeout, after x milliseconds it will ignore the request considering it as a potential attack.
这里是关于全球同一主题的有趣讨论这会更深入一点.
Here is an interesting discussion on globally the same subject that goes a little bit deeper.
相关文章