Im not a developer but seeking suggestions on the setup we have in our environment. As per my understanding, these are the entities involved —
Hibernate 3.2.3
C3P0 - 0.9.5.5
Spring boot - 3.2.18
Tomcat 9
Java thin driver
Oracle DB 19c
I see errors like “Could not get JDBC Connection” in app logs. I suspect the numbers of threads might be just overwhelming the pool. “minPoolSize” is 1 which I think it not right so that’s another problem pertaining to the pool sizing… but I’m after the ratio.
So the question, what ratio is usually followed in highly demanding application having multiple datasources?
I see errors like “Could not get JDBC Connection” in app logs.
This can have many reasons. Please show the full stack trace.
I suspect the numbers of threads might be just overwhelming the pool. “minPoolSize” is 1 which I think it not right so that’s another problem pertaining to the pool sizing… but I’m after the ratio.
The minPoolSize alone doesn’t really matter, unless you also configure some setting to close old/idle connections. Only the maxPoolSize matters with respect to concurrency. You can read more about this in the c3p0 documentation: c3p0-v0.9.5.5 - JDBC3 Connection and Statement Pooling - Documentation
So the question, what ratio is usually followed in highly demanding application having multiple datasources?
As you can imagine, there is no one true answer. It depends on your application. You can configure a maxPoolSize of <# concurrent requests per second> * <average operation duration in seconds> which will in theory allow to saturate the connection pool on average. At the end of the day, you will have to play with the numbers though and just figure out a number that works for you application.