1: Configure the Executor property
Open the/conf/server.xml file and configure a thread pool before connector:
<executor name= "Tomcatthreadpool" nameprefix= "tomcatthreadpool-" maxthreads= "1000" maxidletime= "300000" minsparethreads= "$"/>
Important Parameter Description:
Name: The names of the shared thread pools. This is connector in order to share the name of the thread pool to be referenced, the name must be unique. Default value: None;
Nameprefix: On the JVM, each running thread can have a name string. This property sets a prefix for the name string for each thread in the thread pool, and Tomcat appends the thread number to the prefix. Default value: tomcat-exec-;
maxthreads: The maximum number of threads that the thread pool can hold. Default value: 200;
maxidletime: The time, in milliseconds, that the idle thread is allowed to persist before Tomcat shuts down an idle thread. Idle threads are closed only if the current number of active threads is greater than the value of Minsparethread. Default value: 60000 (one minute).
minsparethreads: The minimum number of inactive threads that Tomcat should always open. Default value: 25.
2: Configure connector
<connector executor= "Tomcatthreadpool" port= "8080" protocol= " Org.apache.coyote.http11.Http11NioProtocol " connectiontimeout=" 20000 " redirectport=" 8443 " minprocessors=" 5 " maxprocessors=" acceptcount= ""/> "
Important Parameter Description:
Executor: Represents the thread pool corresponding to the value of this parameter;
Minprocessors: The number of threads that are created at server startup to process requests;
Maxprocessors: The maximum number of threads that can be created to process requests;
Acceptcount: Specifies the number of requests that can be placed in the processing queue when all the threads that can be used to process the request are used, and requests that exceed this number will not be processed.
Tomcat thread pool Configuration