3 Replies Latest reply on Oct 8, 2008 12:19 PM by peterj

    How to configure database connection count

      Hi All,

      I wonder, if I might configure the number of database connections that might be used by EJB3?

      I configured in my *-ds.xml min and max-pool-size, but if I have a look to my database (mysql) I can only see one connection.

      I think, that my application might be a little more performant, with multiple accesses to the db?!

      Thanks for advice.
      Carsten

        • 1. Re: How to configure database connection count
          peterj

          What is min connection sze set to? I would assume 1.

          Also, consider this. Let's say that an EJB spends on 10% of its time accessing the database. In that case, on average, you would expect that the number of active connections is only 10% of the number of EJBs actively processing requests. Lets further assume that an EJB is only actively processing requests 10% of the time for each user (in other words, accounting for the user's 'think time' between requests). In this situation, 1 connection would be sufficient to support 100 users - of the 100 users, only 10% [10 users] have requests active, and only 10% of those requests [1 request] are accessing the database.

          So the question becomes, what kind of load is on the system?

          • 2. Re: How to configure database connection count

            Hi PeterJ,

            thanks for your reply.

            My min-pool-size is set to 5.

            Even you are right with your calculation, I see that my application take about 5-8 seconds on commiting changes. The load on the system is moderate 50 users maximum and about 20 at an average time.

            I'm not sure, but it seems that one ejb waits for another - because there is only one db connection?! Anyway, I cannot see an additional connection on mysql.

            So - again, I'm not sure, but, I really think that the application would run faster with more connections....

            Best regards,
            Carsten


            • 3. Re: How to configure database connection count
              peterj

              You should be seeing at least 5 connections. Have you limited the number of connections to MySQL (max_connections) in the my.ini (or my.cnf) file?

              Also, verify that the max_connections is set properly by running the mysql client and entering:

              show variables like 'max_conn%';

              How are you determining how many connections there are? What data are you looking at?