Prefer Apache Commons DBCP over c3p0 connection pool
I have simply had too much trouble on my production servers with the c3p0 pool. When the available connections are exhausted the c3p0 pool just locks up and stops handing out connections, and user threads wait indefinately. That causes threads to back up in the JVM until the JVM crashes due to running out of thread stack space. DBCP has proven to be more reliable on at least one higher-load server, so I'm changing the recommended default in Gerrit to DBCP. The wait time of 60 seconds ensures threads don't block indefinately, but instead allows them to abort with an exception indicating the database is not available. Change-Id: I6c94d54b1f09c895c7404ef477f3972ba09da8c2 Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -19,7 +19,8 @@ MySQL:
|
||||
|
||||
Optional Libraries:
|
||||
|
||||
* link:http://sourceforge.net/project/showfiles.php?group_id=25357[c3p0 JDBC Driver]
|
||||
* link:http://commons.apache.org/pool/download_pool.cgi[Commons Pool]
|
||||
* link:http://commons.apache.org/dbcp/download_dbcp.cgi[Commons DBCP]
|
||||
* link:http://www.bouncycastle.org/java.html[Bouncy Castle Crypto API]
|
||||
|
||||
|
||||
@@ -226,7 +227,8 @@ Install the required JDBC drivers by copying them into the
|
||||
their source projects:
|
||||
|
||||
* link:http://jdbc.postgresql.org/download.html[PostgreSQL JDBC Driver]
|
||||
* link:http://sourceforge.net/project/showfiles.php?group_id=25357[c3p0 JDBC Driver]
|
||||
* link:http://commons.apache.org/pool/download_pool.cgi[Commons Pool]
|
||||
* link:http://commons.apache.org/dbcp/download_dbcp.cgi[Commons DBCP]
|
||||
|
||||
Consider installing Bouncy Castle Cypto APIs into the
|
||||
`'$JETTY_HOME'/lib/plus` directory. Some of the Bouncy Castle
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
* Edit user, password, jdbcUrl as necessary below for database.
|
||||
* Edit mail.smtp.host, user, password as necessary for outgoing SMTP.
|
||||
|
||||
* Copy c3p0-0.9.1.2.jar to $JETTY_HOME/lib/plus/
|
||||
* Copy commons-dbcp-*.jar to $JETTY_HOME/lib/plus/
|
||||
* Copy commons-pool-*.jar to $JETTY_HOME/lib/plus/
|
||||
* Copy JDBC driver to $JETTY_HOME/lib/plus/
|
||||
* Copy www/gerrit-*.war to $JETTY_HOME/webapps/gerrit.war
|
||||
|
||||
@@ -37,21 +38,26 @@
|
||||
<Arg></Arg>
|
||||
<Arg>jdbc/ReviewDb</Arg>
|
||||
<Arg>
|
||||
<New class="com.mchange.v2.c3p0.ComboPooledDataSource">
|
||||
<New class="org.apache.commons.dbcp.BasicDataSource">
|
||||
<!-- PostgreSQL
|
||||
<Set name="driverClass">org.postgresql.Driver</Set>
|
||||
<Set name="jdbcUrl">jdbc:postgresql:reviewdb</Set>
|
||||
<Set name="user">gerrit2</Set>
|
||||
<Set name="driverClassName">org.postgresql.Driver</Set>
|
||||
<Set name="url">jdbc:postgresql:reviewdb</Set>
|
||||
<Set name="username">gerrit2</Set>
|
||||
<Set name="password">secretkey</Set>
|
||||
-->
|
||||
<!-- MySQL
|
||||
<Set name="driverClass">com.mysql.jdbc.Driver</Set>
|
||||
<Set name="jdbcUrl">jdbc:mysql://localhost/reviewdb?user=gerrit2&password=secretkey</Set>
|
||||
<Set name="driverClassName">com.mysql.jdbc.Driver</Set>
|
||||
<Set name="url">jdbc:mysql://localhost/reviewdb?user=gerrit2&password=secretkey</Set>
|
||||
-->
|
||||
<!-- H2
|
||||
<Set name="driverClass">org.h2.Driver</Set>
|
||||
<Set name="jdbcUrl">jdbc:h2:file:ReviewDb</Set>
|
||||
<Set name="driverClassName">org.h2.Driver</Set>
|
||||
<Set name="url">jdbc:h2:file:ReviewDb</Set>
|
||||
-->
|
||||
<Set name="initialSize">4</Set>
|
||||
<Set name="maxActive">8</Set>
|
||||
<Set name="minIdle">4</Set>
|
||||
<Set name="maxIdle">4</Set>
|
||||
<Set name="maxWait">60000</Set>
|
||||
</New>
|
||||
</Arg>
|
||||
</New>
|
||||
|
||||
Reference in New Issue
Block a user