I am using c3P0 in my system. I have design question related to changing Pool size based on number of requests.
We have multitenant based application where DB for each tenant is separated. We are using hibernate for persistence and c3p0 for connection pool. The connection pool for each tenant is different.
Right now the connectionpool size for each tenant is static and defined in configuration. But when load increases on 1-2 tenants we need to have more DB connections in for these tenants, without increasing the pool size for other tenants.
What we want is to increase the connection pool size dynamically for these tenant and close unused connections from the connection pool of other tenants on which the load is low.
I was thinking of using maxIdleTime for connections. But because I have a limit on the total number of connections to MySql I need a more proactive approach so the high load connection pools are increased and the low load pools reduced and the unused connections closed.
would just using a high maxPoolSize in your c3p0 configs work? c3p0 automatically “flexes up” pool sizes with demand. (if you want them to flex down quickly, check out maxIdleTimeExcessConnections. if you want to avoid timeouts set maxIdleTime or maxConnectionAge)
See: c3p0’s
docs, especially
configuration properties.