Spring-boot tomcat只能提供少于10,000个连接? [英] Spring-boot tomcat is able to offer only lesser than 10,000 connections?

查看:114
本文介绍了Spring-boot tomcat只能提供少于10,000个连接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用spring-boot测试服务器. 但是,我在进行测试时遇到了一些问题.

I am testing the server with spring-boot. However, I got some problems during doing test.

我的测试是 服务器通过增加Web套接字会话(客户端数量)使用多少个内存.

my test is How many memories server use with increasing the web socket sessions(the number of client).

1,000个客户端(少于9000个会话)在进行测试时没有问题. 但是,当我尝试测试10k连接时,服务器几乎建立了直到10,000个连接.(有时创建会话直到9990,有时是9988、9996这样,而不是特定的套接字数量限制) 之后,它只是停止创建会话,没有错误就没有响应.

1,000 clients(lesser than 9000 sessions) has no issues with doing the test. but, When I tried to test 10k connections, server made connections almost until 10,000.(sometimes creating sessions until 9990, sometimes 9988, 9996 like this, not the specific limit the number of socket) after that, it just stopped creating sessions, no errors just not responding.

如果某些客户端超时并释放连接,则其他正在等待连接的客户端也可以获取连接.

If some clients get timeout and release the connection, other clients which were waiting to connect are able to get connections.

环境" 雄猫:8.0.36 弹簧靴:1.3.3 java:1.8

'environment' tomcat : 8.0.36 spring-boot : 1.3.3 java : 1.8

对于解决方案,我尝试了

for solutions, I tried

  1. 增加堆大小.

  1. increasing heap size.

  • 我将jvm堆内存增加了5GB.但是用于连接的堆内存仅为2GB.因此,我认为它与JVM内存无关.

我在application.porperties中设置了server.tomcat.max-thread = 20000.

I set server.tomcat.max-thread = 20000 in application.porperties.

  • 但是失败了,以前没什么区别.

我对这个问题真的很好奇.如果你们知道这个问题并有想法,请让我知道原因. 谢谢.

I am really curious about this issue. If you guys knows this problem and have ideas, let me know the reason. Thanks.

推荐答案

Tomcat-maxThreads与maxConnections

尝试将maxConnections属性设置为大于10000.

Try to set maxConnections property to be more than 10000.

来自文档:

在任何给定时间服务器将接受并处理的最大连接数.达到此数目后,服务器将接受但不处理另一个连接.在处理的连接数降至maxConnections以下之前,该附加连接将被阻止,此时服务器将再次开始接受和处理新的连接.请注意,一旦达到限制,操作系统仍然可以基于acceptCount设置接受连接.默认值因连接器类型而异.对于BIO,除非使用执行程序,否则默认值为maxThreads的值,在这种情况下,默认值为执行程序的maxThreads的值.对于NIO,默认值为10000.对于APR/本机,默认值为8192.

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.

请注意,对于Windows上的APR/native,配置的值将减小为1024的最大倍数,该最大值小于或等于maxConnections.出于性能原因执行此操作. 如果设置为-1,将禁用maxConnections功能,并且不计算连接数.

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-boot tomcat只能提供少于10,000个连接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆