Set up server mysql and c3p0

Source: Internet
Author: User
Server mysql and c3p0 settings 1) interactive_timeout: parameter meaning: the number of seconds waiting for activity before the server closes the interactive connection. Interactive clients are defined as clients that use the CLIENT_INTERACTIVE option in mysql_real_connect. Default Value of the parameter: 28800 seconds (8 hours) (2) wait_timeout: parameter meaning: Disable the server

Server mysql and c3p0 settings 1) interactive_timeout: parameter meaning: the number of seconds waiting for activity before the server closes the interactive connection. Interactive clients are defined as clients that use the CLIENT_INTERACTIVE option in mysql_real_connect. Default Value of the parameter: 28800 seconds (8 hours) (2) wait_timeout: parameter meaning: Disable the server

Server mysql and c3p0 settings
1) interactive_timeout:
Parameter description: The number of seconds before the server closes the interactive connection. Interactive clients are defined as clients that use the CLIENT_INTERACTIVE option in mysql_real_connect.
Default Value of the parameter: 28800 seconds (8 hours)

(2) wait_timeout:
Parameter description: The number of seconds waiting for activity before the server closes a non-interactive connection.
When a thread starts, the wait_timeout value of the session is initialized based on the global wait_timeout value or the global interactive_timeout value, depending on the client type (defined by the CLIENT_INTERACTIVE connection option of mysql_real_connect ).
Default Value of the parameter: 28800 seconds (8 hours)

The maximum number of connections supported by the MySQL Server is limited, because the creation of each connection consumes memory. Therefore, we hope that after the client connects to the MySQL Server to process the corresponding operations, disconnect and release the occupied memory. If your MySQL Server has a large number of idle connections, they will not only consume the memory in vain, but if the connections continue to accumulate and continue to open, it will eventually reach the maximum number of connections of the MySQL Server, this will report the 'too has connections' error. The value of wait_timeout should be determined based on the system running condition. After the system runs for a period of time, you can run the show processlist command to view the connection status of the current system. If a large number of connection processes in sleep status are found, this parameter is set too large, you can make some adjustments.

Problem:
If you only set the parameter wait_timeout = 100 in the configuration file my. cnf, restart the server and run the following command:
Mysql> show variables like "% timeout % ";
The parameter setting is still 28800 (8 hours by default ).
After querying data, you must set interactive_timeout and wait_timeout at the same time.
[Mysqld]
Wait_timeout = 100
Interactive_timeout = 100
After the MySQL Server is restarted, check that the settings have taken effect.


If you do not restart the database, you can use the following method to set
Set global wait_timeout = 100
Set global interactive_timeout = 100


The following processing is performed on this server, and the record is as follows:

Modify the values of the following three parameters in the configuration file jdbc. properties in the project.

Cpool. checkoutTimeout = 450
Cpool. Max idletime = 600
Cpool. maxIdleTimeExcessConnections = 300

Modify mysql configuration file my. ini

Add the following two lines:
Wait_timeout = 800
Interactive_timeout = 800

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.