Uploaded image for project: 'Commons DBCP'
  1. Commons DBCP
  2. DBCP-579

Performance of DelegatingConnection.prepareStatement(String) regressed enormously in 2.8.0 compared to 1.4

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.8.0
    • Fix Version/s: 2.9.0
    • Labels:
    • Environment:

      OS: Windows Server 2008 R2 Enterprise 

      Java: Open JDK 12.0.1

      DB: Microsoft SQL Server 2012 - 11.0.5058.0 (X64)


      We recently upgraded the commons DBCP from version 1.4 to latest version 2.8.0. After the upgrade, we observed significant degradation in our use case. After the analysis it was found that the performance of DelegatingConnection.prepareStatement(String) is regressed in version 2.8.0 enormously compared to 1.4 where the approx time taken in 2.8.0 is 7400 seconds compared to approx 183 sec in 1.4.

      Looking at the Yourkit snapshot, it is observed that the newly added call PoolingConnection.createKey(String) in the method PoolingConnection.prepareStatement(String) is the major contributor for this regression.


      We took multiple snapshot and in all these snapshot we observed the regression. So it was not intermittent. Also, we observed this with both the our DBs (MS SQL server and PostgreSQL)


      Please find attached the screenshot of YourKit Snapshot showing the Merged Callees of DelegatingConnection.prepareStatement(String) taken for MS SQL server with commons DBCP version 1.4 and version 2.8 for further details.


        1. WithPrivateJarFrom2.9.0.jpg
          367 kB
          Shaktisinh Jhala
        2. DBCP_v2.8.0.jpg
          647 kB
          Shaktisinh Jhala
        3. DBCP_v1.4.jpg
          618 kB
          Shaktisinh Jhala



            • Assignee:
              sjhala Shaktisinh Jhala


              • Created:

                Issue deployment