如何增加超时,以便在处理响应之前,请求不会超时?
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
它使用以下方式服务了 300 个请求200
工作线程。
控制器是用 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
Gattle.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