Crowd incorrectly sizes the database connection pool, resulting in a bottleneck for threads when needing the database

XMLWordPrintable

    • Severity 3 - Minor

      Issue Summary

      When installed, Crowd does not set a maximum DB connection pool size in <home-directory>/shared/crowd.cfg.xml that is greater than the number of threads in the user request pool (configured via maxThreads in <installation-directory>/apache-tomcat/conf/server.xml).

      For example, on a new Crowd 6.3.2 installation with Postgres 16, maxThreads for the default connector (port 8095) in server.xml is set to 150 but hibernate.c3p0.max_size is set to 30:

      crowd.cfg.xml
      <property name="hibernate.c3p0.max_size">30</property>
      <property name="hibernate.c3p0.min_size">0</property>
      

      This means that if more than 30 threads are active and need a DB connection, the C3P0 connection pool is exhausted (hibernate.c3p0.max_size).

      This has been reported to Atlassian support in several cases with busy Crowd servers.

      This is not mentioned in the Installing Crowd Data Center page nor the Running the Setup Wizard page.

      Steps to Reproduce

      1. Install Crowd 6.3.2 with Postgres 16
      2. Check <home-directory>/shared/crowd.cfg.xml and <installation-directory>/apache-tomcat/conf/server.xml

      Expected Results

      The database connection pool should be larger and Crowd should not become bottlenecked on awaiting DB connections from the connection pool (c3p0).

      Actual Results

      The database connection pool is 20% the size of the HTTP user request thread pool, and this can cause instability and startup issues with Crowd, as described further in Crowd not able to start up due to database pool max-out.

      Workaround

      The issue and workaround is further described in Crowd not able to start up due to database pool max-out, but essentially involves increasing the DB connection pool size and restarting:

      1. Edit <home-directory>/shared/crowd.cfg.xml and increase the hibernate.c3p0.max_size property to a value that matches maxThreads in the instance's <installation-directory>/apache-tomcat/conf/server.xml. Restart Crowd for this new setting to take effect.
      2. Ensure that your database will accept that many simultaneous database connections (sometimes called MAX_CONNECTIONS)

              Assignee:
              Michal Samujlo
              Reporter:
              Malcolm Ninnes
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 25m
                  25m