2
  1. If my tomcat is configured to accept 100 incoming requests concurrently, how many connections should be present in DB connection pool ? In other words, if there a known optimal ratio of number of connections / number of incoming requests ?

  2. Is it possible that application servers have made more requests / transactions per second than the db is configured to handle ? If yes, then what happens ? Are transactions queued ? dropped ?

1
  • 1
    During my work with some developers they always configure database connection nearly 33% of tomcat max connection. if the application server made request more than DB can handle it will make DB very slow, then the application server will have performance issue due queue Commented Dec 16, 2015 at 8:55

1 Answer 1

0

In general the max number of running sessions has a relation with the number of CPU cores on the database server. If you have 32 cores it does not make sense to allow more connections and expect them all to run concurrently.

Because in most of the times there will be some waiting, you could allow a few more but the database system itself also needs some CPU to work for you.

So your database connection pool should not have many more connections than there are available CPU cores to run them on.

When all CPU's are loaded, the application will have to wait for connections to return results and putting more stress on the database will slowdown the application more.

The optimal connection pool size can be smaller but depends on the transaction length and the number of concurrent transactions. If every transaction returns it's connection to the pool the system can handle a lot of work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.