DBCP Connection Pool Usage issues

Source: Internet
Author: User
Tags connection pooling

Problem phenomenon:

Launch the app, access stress-free, everything is fine, after a while, apply access exceptions.

Problem Analysis:

1, the Web container thread is full, denial of service. Because the application concurrency is large and the thread response time increases, the number of threads pool connections increments until it is full, resulting in the application denial of service.

2, through the analysis of the thread information, found that the thread processing time is stuck in the connection database, through the database server check, the database is no problem.

3. The database connection exception was discovered by querying the server log: The connection timed out.

4, Query DBCP connection pool connection usage, idle links and use the link is also normal.

Problem thinking:

From the above information can be confirmed that the problem must be in the application layer, and is the application connection between the database, but why the connection pool has a normal link, but not connected? While the project started normally, but ran for a period of time, it reported the database connection timeout exception information. Thread time is the process of consuming waiting for a database connection. The connection pool has not reached the maximum number of connections, the idle connection is still there, but why not connect it?

Solve the problem:

With the above questions, repeatedly check the connection pool profile information, whether the configuration problem, a few configuration information gave me inspiration, with this thoughts continue to repeat the process of the problem and the observation of the log, and finally found the problem is that the database connection pool idle link timeout. However, the connection pool is not immediately recycled, and when a new request comes in, the free link in the connection pool continues to be allocated, but the connection pool does not verify the validity of the link, so the thread has a process of waiting for a timeout.

Solution:

1. Configuring a debit link requires a connection pool to detect this link validity: Testonborrow

2. Configuration also links require connection pooling to detect this link validity: Testonreturn

3. Configuration requires connection pool timing detection idle link validity: Testwhileidle

DBCP Connection Pool Usage issues

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.