Spring-boot tomcat 只能提供不到 10,000 个连接?
Spring-boot tomcat is able to offer only lesser than 10,000 connections?
我正在用 spring-boot 测试服务器。
但是,我在做测试的过程中遇到了一些问题。
我的测试是
随着网络套接字会话的增加(客户端数量),服务器使用了多少内存。
1,000 个客户端(少于 9000 个会话)进行测试没有问题。
但是,当我尝试测试 10k 连接时,服务器几乎建立了连接直到 10,000。(有时创建会话直到 9990,有时 9988、9996 这样,而不是具体限制套接字数量)
在那之后,它只是停止创建会话,没有错误只是没有响应。
如果一些客户端超时并释放连接,其他等待连接的客户端能够获得连接。
'environment'
tomcat:8.0.36
spring-启动:1.3.3
java : 1.8
对于解决方案,我尝试了
增加堆大小。
- 我将 jvm 堆内存增加了 5GB。但是用于连接的堆内存只有 2GB。所以,我认为它与 JVM 内存无关。
我在application.porperties中设置了server.tomcat.max-thread=20000。
- 但是失败了,跟之前没区别
我对这个问题很好奇。如果你们知道这个问题并且有想法,请告诉我原因。
谢谢。
Tomcat - maxThreads vs maxConnections
尝试设置maxConnections
属性大于10000
来自the doc:
The maximum number of connections that the server will accept and process at any given time. When this number has been reached, the server will accept, but not process, one further connection. This additional connection be blocked until the number of connections being processed falls below maxConnections at which point the server will start accepting and processing new connections again. Note that once the limit has been reached, the operating system may still accept connections based on the acceptCount setting. The default value varies by connector type. For BIO the default is the value of maxThreads unless an Executor is used in which case the default will be the value of maxThreads from the executor. For NIO the default is 10000
. For APR/native, the default is 8192
.
Note that for APR/native on Windows, the configured value will be reduced to the highest multiple of 1024 that is less than or equal to maxConnections. This is done for performance reasons.
If set to a value of -1, the maxConnections feature is disabled and connections are not counted.
spring启动有一个属性,tomcatmax-connection,需要在application.properties文件
中设置
server.tomcat.max-connections= # Maximum number of connections that the server will accept and process at any given time.
我正在用 spring-boot 测试服务器。 但是,我在做测试的过程中遇到了一些问题。
我的测试是 随着网络套接字会话的增加(客户端数量),服务器使用了多少内存。
1,000 个客户端(少于 9000 个会话)进行测试没有问题。 但是,当我尝试测试 10k 连接时,服务器几乎建立了连接直到 10,000。(有时创建会话直到 9990,有时 9988、9996 这样,而不是具体限制套接字数量) 在那之后,它只是停止创建会话,没有错误只是没有响应。
如果一些客户端超时并释放连接,其他等待连接的客户端能够获得连接。
'environment' tomcat:8.0.36 spring-启动:1.3.3 java : 1.8
对于解决方案,我尝试了
增加堆大小。
- 我将 jvm 堆内存增加了 5GB。但是用于连接的堆内存只有 2GB。所以,我认为它与 JVM 内存无关。
我在application.porperties中设置了server.tomcat.max-thread=20000。
- 但是失败了,跟之前没区别
我对这个问题很好奇。如果你们知道这个问题并且有想法,请告诉我原因。 谢谢。
Tomcat - maxThreads vs maxConnections
尝试设置maxConnections
属性大于10000
来自the doc:
The maximum number of connections that the server will accept and process at any given time. When this number has been reached, the server will accept, but not process, one further connection. This additional connection be blocked until the number of connections being processed falls below maxConnections at which point the server will start accepting and processing new connections again. Note that once the limit has been reached, the operating system may still accept connections based on the acceptCount setting. The default value varies by connector type. For BIO the default is the value of maxThreads unless an Executor is used in which case the default will be the value of maxThreads from the executor. For NIO the default is
10000
. For APR/native, the default is8192
.Note that for APR/native on Windows, the configured value will be reduced to the highest multiple of 1024 that is less than or equal to maxConnections. This is done for performance reasons. If set to a value of -1, the maxConnections feature is disabled and connections are not counted.
spring启动有一个属性,tomcatmax-connection,需要在application.properties文件
中设置server.tomcat.max-connections= # Maximum number of connections that the server will accept and process at any given time.