The last packet successfully received from the server was XXX seconds ago

Database Connection Pools

Using a connection pool is recommended for improving the performance of your application, and to ensure that your application handles excessive concurrency without overloading your Shared Database configurations (which have a limited number of connections available to the application). CloudBees datasources use the Apache DBCP connection pool implementation, which has a wide set of connection options.  The configuration below is a good configuration for a lightly loaded application or an application running in the free app+db tier.

<resource name="jdbc/DATASOURCE_NAME" auth="Container" type="javax.sql.DataSource">
<param name="username" value="USERNAME" />
<param name="password" value="PASSWORD" />
<param name="url" value="JDBC_URL" />

<!-- Connection Pool settings -->
<param name="maxActive" value="5" />
<param name="maxIdle" value="2" />
<param name="maxWait" value="10000" />
<param name="removeAbandoned" value="true" />
<param name="removeAbandonedTimeout" value="60" />
<param name="logAbandoned" value="true" />
</resource>

Avoiding Database Idle Timeouts

MySQL includes a timeout that will close connections that have been idle for long periods of time. For improved Database performance, CloudBees DataSources use the Apache DBCP connection pool to reuse JDBC connections after they are closed by the application. If you use a connection that has been in the pool idle for too long, your application will likely experience the following error: "The last packet successfully received from the server was XXX seconds ago". The connection pool includes a setting the will validate and throw out dead connections when calling javax.sql.DataSource.getConnection(). To use this setting, add the following XML params to your DataSource definition in cloudbees-web.xml.

<param name="validationQuery" value="SELECT 1" />
<param name="testOnBorrow" value="true" />
http://wiki.cloudbees.com/bin/view/RUN/DatabaseGuide

你可能感兴趣的:(server,application,database,concurrency,performance,overloading)