Details about tomcat connection count and thread pool, and details about tomcat Thread PoolPreface
When using tomcat, you often encounter configuration problems such as the number of connections and the number of threads. To really understand these concepts, you must first understand
Understanding about Tomcat thread pool and tomcat Thread PoolBy default, Tomcat creates a bound thread pool for each connector (the maximum number of threads is 200 ). In most cases, you do not need to change this configuration (unless you increase the maximum number of thre
Tomcat6.0 connection pool Configuration1. Configure the context. xml file in the conf file under tomcat, and add the connection pool Configuration between them:
2. Add the following content to the Web. xml file of your application:
3. Put the Third-Party driver connecting to the database under common/lib.4. I will not write the test program.
Tomcat5.5x conn
Tags: cal common data Source Comm HTTPS creates interface complex RGScollection (+) Tomcat has been using COMMONS-DBCP as a connection pool for the previous version of 7.0, but DBCP has been criticised for the following reasons:
DBCP is single-threaded, in order to ensure that the entire connection pool is locked by the line Shuo plenary
DBCP Poor p
Tomcat has been using COMMONS-DBCP as a connection pool for the previous version of 7.0, but DBCP has been criticised for the following reasons:
DBCP is single-threaded, in order to ensure that the entire connection pool is locked by the line Shuo plenary
DBCP Poor performance
DBCP is too complex, more than 60 classes
DBCP using static interf
three important parameters for Tomcat connection pool
The three key parameters of the Tomcat connection pool, the configuration of the connection pool is very important, the configuration is not easy to cause the operation of the program is stable, the following common prob
people say that the request backlog in the final buffer queue is not good control, see the specific business scenario, buffer queue also have different gameplay (detailed).PrincipleOur colleague Lao Wang, after studying a threadpool mechanism, proposed the way to implement the queue. It happened that Tomcat did exactly that, and the Tomcat-based thread pool was
Label:Tomcat used COMMONS-DBCP as the implementation of connection pooling in versions prior to 7.0, but there are some problems with DBCP:(1) DBCP is single-threaded, in order to ensure that the line Shuo plenary lock the entire connection pool(2) Poor performance of DBCP(3) DBCP is too complex, more than 60 classes, development lag.As a result, other high-performance connection pools, such as C3P0, and Druid of the Ali system, are often used in the
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 25The 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.Maxidlet
/bio mode, thread pool, number of connections, and so on.Depending on the protocol, Connector can be divided into HTTP Connector, AJP Connector, etc., this article only discusses HTTP Connector.The protocol of Nio, Bio, APR1 and connectorConnector uses a different protocol when processing an HTTP request. Different versions of Tomcat support different protocol, of which the most typical protocol include bio
Tomcat in the previous version of 7.0 are using COMMONS-DBCP as a connection pool, but DBCP was criticized for the reasons: DBCP is single-threaded, in order to ensure that the line Cheng Ann Plenary lock the entire connection pool dbcp poor performance dbcp too complex, more than 60 classes DBCP Using static interfaces, compiling problems with JDK 1.6 dbcp devel
the ability to automatically reclaim idle connections.Steps to use:1, add jar package C3p0-0.9.1.2.jar, download location: http://www.oschina.net/p/c3p0, open source China has detailed. 2, write the configuration file c3p0-config.xml, file name fixed, can not be changed, "C3p0 Baidu Encyclopedia" has detailed configuration information, compared to the whole.default-config>//127.0.0.1:3306/test default-config>3. Writing tool classes Public classC3p0util {Private StaticCombopooleddatasource
Reprinted:
1. Problem DescriptionWebProgramIt was very fast at the beginning of Tomcat, but after a while it was found that the speed became very slow.Check log output and find exceptions as follows:Org. Apache. commons. DBCP. sqlnestedexception: cannot get a connection, pool exhausted, cause:Java. util. nosuchelementexception: timeout waiting for idle objectAt the same time, in the sqlserver event probe
Configure the data source and connection pool in Tomcat and tomcat Data Source
(1) Why do I need to configure the data source and connection pool?
We know that every time the java program connects to the database, we need to request a connection to the database, open the read data, and then close it,
In this way, each
DBCP Connection Pool configuration
About DBCP Connection pool The specific use of the method also need to refer to: Click to open the link dbcp jar package
Commons-dbpc.jar, Commons-collections.jar, commons-pool.jar download click to downloadc3p0 Connection Pool configuration
For more information on C3P0 connection pooling use: Click to open linkc3p0 jar
While (dbset. Next () {clob = (oracleresultset) dbset). getclob (1); clob. putstring (1, questioncontent );
Or
If (RSS. Next () {clob = (clob) RSS. getclob (1); clob. putstring (1, allmobilecode );}
If the connection pool is used for insertion, an error is returned. java. Lang. classcastexception: org. Apache. commons. DBCP. delegatingresultset (type conversion exception)
When you operate in JDBC mode, everything is normal. If you switch to the JN
Use Tomcat for browsing, instead of the built-in GWT, so that Tomcat context information can be obtained and the client can be submitted in one step.
Complete source code (for the convenience of the compiled files): wylpeace-Tomcat
Environment Establishment1, download eclipse3.2: http://download.eclipse.org/eclipse/downloads/index.php2, download tomcat5.5: http:
/bio mode, thread pool, number of connections, and so on.Depending on the protocol, Connector can be divided into HTTP Connector, AJP Connector, etc., this article only discusses HTTP Connector.DirectoryI. Nio, Bio, APR1, connector's protocol2. How to Choose Protocol3. What is the difference between Bio/nioTwo, 3 parameters: Acceptcount, MaxConnections, MaxThreads1, Acceptcount2, MaxConnections3, MaxThreads4. Parameter settingThird, thread
/bio mode, thread pool, number of connections, and so on.Depending on the protocol, Connector can be divided into HTTP Connector, AJP Connector, etc., this article only discusses HTTP Connector.DirectoryI. Nio, Bio, APR1, connector's protocol2. How to Choose Protocol3. What is the difference between Bio/nioTwo, 3 parameters: Acceptcount, MaxConnections, MaxThreads1, Acceptcount2, MaxConnections3, MaxThreads4. Parameter settingThird, thread
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.