tomcat - tomcat 执行器中的解释 maxQueueSize

标签 tomcat threadpoolexecutor

请说明tomcat执行器中参数maxQueueSize的含义。

一个额外的问题 - 它是否链接到 tomcat 连接器中的 acceptCount

提前致谢。

最佳答案

这被很好地提及 here

Each incoming request requires a thread for the duration of that request. If more simultaneous requests are received than can be handled by the currently available request processing threads, additional threads will be created up to the configured maximum (the value of the maxThreads attribute). If still more simultaneous requests are received, they are stacked up inside the server socket created by the Connector, up to the configured maximum (the value of the acceptCount attribute). Any further simultaneous requests will receive "connection refused" errors, until resources are available to process them.

maxQueueSize :-在我们拒绝它们之前可以排队等待执行的可运行任务的最大数量。默认值为 Integer.MAX_VALUE

参数acceptCount与TCP队列有关。在这个队列中,操作系统可以保持一定数量的连接,即使它们不能立即处理。这个概念是特定于操作系统的——对于 Linux,您可以引用 here 来理解这一点。更多的见解是here .

ma​​xQueueSize 是包含实际请求处理任务的队列,可由最多 maxThreads 个线程运行。它们实际上在队列中,因为处理线程的数量有限,任务在队列中花费一些时间,然后被执行器拾取并分配给一个空闲的线程来执行任务。

关于tomcat - tomcat 执行器中的解释 maxQueueSize,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30613474/

相关文章:

java - 目标服务器未能响应

java - 通过 JWS 和生成的 JNLP 部署 Java 应用程序

java - 为什么 ThreadPoolExecutor 的 afterExecute() 异常为 null?

multithreading - 当另一个任务正在运行时,如何拒绝 newSingleThreadExecutor 中的新任务

java - 线程池重用线程

Python ThreadPoolExecutor 终止所有线程

mysql - Gitlab-CI : Test Job is failing

java - 无法使用以下凭据连接到数据库 :jdbc:oracle:thin@:smthing

java - JAAS : on Callback ( Interesting based on HTTP headers )

java - 在java中使用Executors时出现内存不足错误