Java tomcat 默认可以处理多少并发请求

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18372464/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 00:57:33  来源:igfitidea点击:

How many concurrent request can tomcat handle by Default

javatomcat

提问by user1281029

How many requests Tomcat7.0.42 handle at a time.Can we configure the same in any external File.If so where.

Tomcat7.0.42一次处理多少个请求。我们可以在任何外部文件中配置相同的。如果是在哪里。

采纳答案by Juned Ahsan

It depends on the type connector you are using to accept the requests. There is parameter called maxConnectionsin server.xmlthat can be configured to throttle the number of incoming requests. Here is the description of maxConnections params for Tomcat 7:

这取决于您用于接受请求的连接器类型。有参数调用maxConnectionsserver.xml,可配置节流传入请求的数目。以下是Tomcat 7 的 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 not accept any more connections until the number of connections falls below this value. The operating system may still accept connections based on the acceptCount setting. 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

服务器在任何给定时间将接受和处理的最大连接数。达到此数量后,服务器将不再接受任何连接,直到连接数低于此值。操作系统可能仍会根据 acceptCount 设置接受连接。默认值因连接器类型而异。对于 BIO,默认值是 maxThreads 的值,除非使用了 Executor,在这种情况下,默认值将是来自 executor 的 maxThreads 值。对于 NIO,默认为 10000。对于 APR/native,默认为 8192。

请注意,对于 Windows 上的 APR/native,配置的值将减少到小于或等于 maxConnections 的 1024 的最大倍数。这样做是出于性能原因。如果设置为 -1 的值,则禁用 maxConnections 功能并且不计算连接数

回答by Scary Wombat

Tomcat's connectors can be configured to only service a certain number of requests simultaneously -- that's configured as the maxConnections attribute of a in server.xml

Tomcat 的连接器可以配置为只同时处理一定数量的请求——这被配置为 server.xml 中 a 的 maxConnections 属性

回答by Prateek

In server.xmlfile you specify maxThreadswhich specifies maximum number of simultaneous requests that can be handled..

server.xml文件中指定maxThreads哪个specifies maximum number of simultaneous requests that can be handled..

<Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="4443" acceptCount="100"
               debug="0" connectionTimeout="60000" 
               disableUploadTimeout="true" />

In Tomcat 7,

在 Tomcat 7 中,

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.

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.

EDIT: 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.

编辑:如果执行程序与此连接器关联,则忽略此属性,因为连接器将使用执行程序而不是内部线程池执行任务。

For more info, refer this link Tomcat 7 Doc

有关更多信息,请参阅此链接Tomcat 7 Doc