Tomcat7 database connection pool has 25 advantages over tomcatjdbc, and tomcat7tomcatjdbc

Source: Internet
Author: User

Tomcat7 database connection pool has 25 advantages over tomcatjdbc, and tomcat7tomcatjdbc
Tomcat JDBC connection pool org. apache. tomcat. jdbc. pool change or replace Apache Commons DBCP connection pool.
Why do we need a new connection pool?
There are several reasons:
1. DBCP 1.x is single-threaded. To become a thread-safe shared lock, the entire pool allocates two objects and returns objects in a short time. Note that this does not apply to DBCP 2.x.
2. DBCP 1. x can be slow. The increase in the number of logical CPUs and the increase in the number of concurrent threads trying to borrow or return objects will reduce the performance. It can have a significant impact on high-concurrency systems. Note that this does not apply to Commons DBCP 2.x.
3. DBCP exceeds 60 categories. The core of tomcat-jdbc-pool is eight categories. Therefore, in the future, fewer changes are required. This is all you need to run the connection pool itself and rest is gravy.
4. DBCP uses static interfaces. This means that you must use the correct version for the given JRE version or you may see the NoSuchMethodException exception.
5. It is not worth rewriting more than 60 classes. When a connection pool is implemented, it is easier.
6. Tomcat jdbc pool implements asynchronous retrieval connection without adding additional thread library itself.
7. Tomcat jdbc pool is Tomcat module, which depends on Tomcat Julie. The simplified log framework is used for Tomcat.
8. Use the javax. SQL. PooledConnection interface to retrieve the underlying connection.
9. Proof of hunger. If the pool is empty and the thread is waiting for a return connection, the connection will be awake and the correct thread will wait. Most pools only starve to death.
10. added other connection pool implementations for features
11. Supports high-concurrency environments and multi-core/cpu Systems.
12. dynamically Implemented interfaces will support java. SQL and javax. SQL interface your runtime environment (as long as your JDBC driver does the same thing), even if you compile a lower version of JDK.
13. Verification interval -- we don't need to verify the connection we use every time. We can do this. When we borrow or return the connection, we can not configure it more frequently than the interval.
14. Run-Once query. A configurable query will only Run Once when connected to the database. It is very useful for setting session settings. You want to establish a connection throughout the time.
15. Configure the custom interceptor capability. This allows you to write custom interceptors to enhance functions. You can use the Interceptor to collect query statistics, cache session Status, reconnect failed, retry query, and cache query results. Your choice is endless, And the interceptor is dynamic, instead of binding to a JDK version of the java. SQL/javax. SQL interface.
16. High Performance-we will show some performance differences
17. it is very simple. Because of its simplified implementation, the number of lines and the number of source files is very low. Compared with c3p0, there are more than 200 source files (we checked last time) and Tomcat jdbc 8 core files, the connection pool itself is half of the errors that may occur, and they will track and fix them more quickly. Reducing complexity has always been the focus of "leeching space".
18. asynchronous retrieval-you can connect your Connection request and receive the queue Future <Connection> back.
19. Better idle connection processing. Instead of shutting down the connection directly, it can still use the size of the connection pool and the smart algorithm of the idle pool.
20. You can decide when the connection is considered to be abandoned. When the pool is full, or directly timeout by specifying the threshold for using a pool.
21. abandoning the connection timer will post a statement to reset/query the activity. A connection is allowed and does not time out for a long period of time. This is done by using ResetAbandonedTimer
22. After the connection is closed, the connection takes a specific time. The age is close to that returned to the pool.
23. JMX notification, when the connection is suspected to be an obsolete log entry. This is similar to removeAbandonedTimeout, but it only reports information without any action. This is done by using the suspectTimeout attribute.
24. The connection can be retrieved from java. SQL. Driver, javax. SQL. DataSource or javax. SQL. XADataSource. This is done by using the dataSource and dataSourceJNDI attributes.
25. Support for JMX and XA Connection
Tomcat7 database connection pool: 25 Advantages of tomcatjdbc
That guy helps me explain the tomcat database connection pool, the database connection pool configured by hibernate, mysql or oracle database connection pool?

No. If it is configured in the configuration file of spring or hibernate, you do not need to configure the tomcat database connection pool and configure the connection pool in the tomcat configuration file to maintain the connection pool, which is both troublesome and poor.

How to configure tomcat database connection pool?

Which version of TOMCAT do you use? Download the corresponding admin
In this way, you can have the console of the server, where there are configuration items for the connection pool,
Add as required.

Your
Context. xml or server. xml

Will appear

The XML section provided by Lijiang haiyue Inn.

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.