Question
Pegasystems Inc.
JP
Last activity: 18 Feb 2021 20:40 EST
Commons DBCP vs Tomcat JDBC Pool
Hi,
There was a pretty big change made in Tomcat as to JDBC connection pool facility. Tomcat has updated its default connection pooling library to Tomcat JDBC Pool ("tomcat-jdbc-pool") in Tomcat 8. Tomcat 7 and earlier version used Commons DBCP ("commons-dbcp"). For example, Tomcat JDBC Pool uses "maxTotal" instead of "maxActive" to limit the number of connections. In order to enable this new feature Tomcat JDBC Pool, you need to add factory attribute in your context.xml. In summary,
- If you are using Tomcat 7, you can use maxActive & maxWait.
- If you are using Tomcat 8, you should use maxTotal & maxWaitMillis.
- If you are using Tomcat 8, you should also add factory attribute as follows: factory="org.apache.tomcat.jdbc.pool.DataSourceFactor"
Question:
Is my understanding above correct? If yes, here is my proposal to installation guide creation team:
Hi,
There was a pretty big change made in Tomcat as to JDBC connection pool facility. Tomcat has updated its default connection pooling library to Tomcat JDBC Pool ("tomcat-jdbc-pool") in Tomcat 8. Tomcat 7 and earlier version used Commons DBCP ("commons-dbcp"). For example, Tomcat JDBC Pool uses "maxTotal" instead of "maxActive" to limit the number of connections. In order to enable this new feature Tomcat JDBC Pool, you need to add factory attribute in your context.xml. In summary,
- If you are using Tomcat 7, you can use maxActive & maxWait.
- If you are using Tomcat 8, you should use maxTotal & maxWaitMillis.
- If you are using Tomcat 8, you should also add factory attribute as follows: factory="org.apache.tomcat.jdbc.pool.DataSourceFactor"
Question:
Is my understanding above correct? If yes, here is my proposal to installation guide creation team:
The guide should state above as a note because it is pretty important (if you misuse wrong parameters, for example misusing maxActive in Tomcat 8, then your setting will be ignored). Currently 7.4 installation guide talks about only maxActive instead of maxTotal, and 8.3 guide does not state the importance of factory attribute - I have already seen a couple of customers misusing incorrect parameters. I am suspecting that this confusion may even cause another severe error (https://collaborate.pega.com/question/anyone-managed-successfully-install-82).
[7.4 installation guide]
Isn't this wrong?
[8.3 installation guide]
It will be better to write some explanation of the importance of factory attribute in Tomcat 8x or people may just copy old settings from prior version environment and forget it.
Let me know if my suggestion makes sense or not.
Thanks,
***Edited by Moderator: Lochan to update SR details***