Tomcat中的maxConnections、maxThreads、acceptCount

先摘取官网对这3个属性的描述:

acceptCount The maximum queue length for incoming connection requests when all possible request processing threads are in use. Any requests received when the queue is full will be refused. The default value is 100. 当请求的处理线程都被占用时(线程数量由maxThreads限制),传入连接请求的最大队列长度。队列已满时收到的任何请求都将被拒绝。默认值为100。
maxConnections 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. 服务器在任何给定时间将接受和处理的最大连接数。达到此数目后,服务器将接受但不处理新连接。当在处理的连接数少于maxConnections时,被挂起的连接开始被处理。请注意,一旦达到限制,操作系统仍然可以基于acceptCount设置接受连接。默认值因连接器类型而异。对于BIO,除非使用执行程序,否则默认值为maxThreads的值;对于NIO,默认值为10000。对于APR / native,默认值为8192。
请注意,对于Windows上的APR /native,实际配置的值将小于等于maxConnections,并为1024的最大倍数。这样做是出于性能原因。
如果设置为-1,将禁用maxConnections功能,并且不计算连接数。
maxThreads  The maximum number of request processing threads to be created by this Connector, which therefore determines the maximum number of simultaneous requests that can be handled. If not specified, this attribute is set to 200. If an executor is associated with this connector, this attribute is ignored as the connector will execute tasks using the executor rather than an internal thread pool. Note that if an executor is configured any value set for this attribute will be recorded correctly but it will be reported (e.g. via JMX) as -1 to make clear that it is not used. 此连接器将创建的请求处理线程的最大数量,因此它确定了可以同时处理的请求的最大数量。如果未指定,则此属性设置为200。如果执行程序与此连接器相关联,则此属性将被忽略,因为连接器将使用执行程序而不是内部线程池执行任务。请注意,如果配置了执行程序,则将正确记录为此属性设置的任何值,但会将其报告为(例如,通过JMX)-1,以表明未使用该值。
 



 

发布了86 篇原创文章 · 获赞 92 · 访问量 33万+

猜你喜欢

转载自blog.csdn.net/suo082407128/article/details/102951508