如何在一定时间后停止 tomcat 处理请求?
How to stop tomcat from processing request after certain time?
我的 tomcat 服务器持续处理某些请求超过 10 分钟。我停止了触发这些请求的客户端,但随后 tomcat 继续处理这些请求。
我在 tomcat 的 server.xml
文件中尝试了 connectionTimeout
属性 的不同设置,但它不起作用。
我想知道如何配置 tomcat 以便 tomcat 终止/停止处理超过特定时间(如 10 秒或 1 分钟等)的请求
来自 The Apache Tomcat Connector - Generic HowTo
超时
JK can also use a timeout on request replies. This timeout does not
measure the full processing time of the response. Instead it controls,
how much time between consecutive response packets is allowed.
In most cases, this is what one actually wants. Consider for example
long running downloads. You would not be able to set an effective
global reply timeout, because downloads could last for many minutes.
Most applications though have limited processing time before starting
to return the response. For those applications you could set an
explicit reply timeout. Applications that do not harmonise with reply
timeouts are batch type applications, data warehouse and reporting
applications which are expected to observe long processing times.
If JK aborts waiting for a response, because a reply timeout fired,
there is no way to stop processing on the backend. Although you free
processing resources in your web server, the request will continue to
run on the backend - without any way to send back a result once the
reply timeout fired.
我的 tomcat 服务器持续处理某些请求超过 10 分钟。我停止了触发这些请求的客户端,但随后 tomcat 继续处理这些请求。
我在 tomcat 的 server.xml
文件中尝试了 connectionTimeout
属性 的不同设置,但它不起作用。
我想知道如何配置 tomcat 以便 tomcat 终止/停止处理超过特定时间(如 10 秒或 1 分钟等)的请求
来自 The Apache Tomcat Connector - Generic HowTo 超时
JK can also use a timeout on request replies. This timeout does not measure the full processing time of the response. Instead it controls, how much time between consecutive response packets is allowed.
In most cases, this is what one actually wants. Consider for example long running downloads. You would not be able to set an effective global reply timeout, because downloads could last for many minutes. Most applications though have limited processing time before starting to return the response. For those applications you could set an explicit reply timeout. Applications that do not harmonise with reply timeouts are batch type applications, data warehouse and reporting applications which are expected to observe long processing times.
If JK aborts waiting for a response, because a reply timeout fired, there is no way to stop processing on the backend. Although you free processing resources in your web server, the request will continue to run on the backend - without any way to send back a result once the reply timeout fired.