如何增加超时时间,以便在处理响应之前,请求不超时?
Spring Boot中的Tomcat设置:
server.tomcat.max-connections=2000
server.tomcat.max-threads=200
server.connection-timeout=1200000
constantUsersPerSec(20) during (15)在15秒的过程中,每秒的请求数增加到300,并且所有请求均得到满足,如下面的加特林(蓝色)所示。
scn.inject(
constantUsersPerSec(20) during (15),
)
这是由于max-connections = 2000使用200工作线程处理了300个请求。
控制器是用Spring MVC编写的,它返回后DeferredResult会执行异步请求处理,因此一旦响应被处理,它将恢复响应。
但是,即使server.connection-timeout将其设置为较高的数字,1200000也有很多503即将结束(红色)
> status.find.in(200,304,201,202,203,204,205,206,207,208,209), b 78 (100.0%)
ut actually found 503
Gatling.conf也设置为增加超时时间:
timeOut {
simulation = 8640000 # Absolute timeout, in seconds, of a simulation
}
ahc {
#keepAlive = true # Allow pooling HTTP connections (keep-alive header automatically added)
connectTimeout = 600000 # Timeout when establishing a connection
handshakeTimeout = 600000 # Timeout when performing TLS hashshake
pooledConnectionIdleTimeout = 600000 # Timeout when a connection stays unused in the pool
readTimeout = 600000 # Timeout when a used connection stays idle
#maxRetry = 2 # Number of times that a request should be tried again
requestTimeout = 600000
芜湖不芜
相关分类