Tomcat 6.0 shared thread pool configuration shared executor Thread Pool

Source: Internet
Author: User

Modify the conf/server. xml file


Easy Configuration

Step 1: Open the shared Thread Pool

  1. <ServiceName = "Catalina">
  2. <! -- The connectors can use a shared executor, you can define one or more named thread pools -->
  3. <ExecutorName = "tomcatthreadpool" nameprefix = "Catalina-Exec -"
  4. Maxthreads = "1000" minsparethreads = "50" maxidletime = "600000"/>

<Service name = "Catalina"> <! -- The connectors can use a shared executor, you can define one or more named thread pools --> <executor
Name = "tomcatthreadpool" nameprefix = "Catalina-Exec-" maxthreads = "1000" minsparethreads = "50" maxidletime = "600000"/>

Comments before and after the default value <! --> Drop, remove it. Where

Name
The name used to reference this pool in other places in server. xml. The name is required and must be unique.
This is the name of the thread pool and must be unique. We will use this in the subsequent configuration.

Nameprefix
(String) the name prefix for each thread created by the executor. The thread name for an individual thread will be nameprefix + threadnumber
The thread name prefix, used to mark the thread name, so that each thread adds the thread number with this prefix, such
Catalina-exec-1
Catalina-exec-2


========================================================

Maxthreads
(INT) The Max number of active threads in this pool, default is 200
The maximum number of threads allowed in the thread pool. The default value is 200. High concurrency should be set to a higher value. It is only a limit and does not occupy resources.
Minsparethreads
(INT) The minimum number of threads always kept alive, default is 25
The minimum number of threads that remain active. The default value is 25. This should be adjusted based on the load. Too small will affect the response speed, and too large to occupy resources in vain.
Maxidletime
(INT) the number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minsparethreads. default value is 60000 (1 minute)
The number of threads that exceed the minimum number of active threads. If the idle time exceeds this setting, the thread will be shut down. The default value is 1 minute.

The number of threads created during Tomcat initialization.


Maxthreads Tomcat uses threads to process each request received. This value indicates the maximum number of threads that Tomcat can create.
Acceptcount indicates the number of requests that can be placed in the processing queue when the number of threads that can be used to process requests is used. requests exceeding this number are not processed.
Connnectiontimeout
Network Connection timeout, in milliseconds. If it is set to 0, it indicates that the request Never times out. This setting has potential risks. Generally, it can be set to 30000 ms.

Maxsparethreads
Once the created thread exceeds this value, Tomcat closes the socket thread that is no longer needed.
Threadpriority
(INT) the thread priority for threads in the executor, the default is thread. norm_priority
The thread level. The default value is thread. norm_priority.



========================================================== ========================================================== ===
Step 2
Specify the sharing thread pool in Connector

  1. <Connector
  2. Port = "8009"
  3. Protocol = "AJP/1.3"
  4. Maxthreads = "5000"
  5. Executor = "tomcatthreadpool"

<Connector Port = "8009" protocol = "AJP/1.3" maxthreads = "5000" executor = "tomcatthreadpool"


Note: Once the thread pool is used, other thread attributes, such as maxthreads, will be ignored.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.