问题
I am using c3p0 connection pool and I have minPoolSize=1 maxPoolSize=5 and InitialPoolSize=5.
When server starts, i can see it is having 5 connection. But as the first request came, that no. increases to 10. And from then onwards it stays 10 as those 10 connections are handling that load. Now my question is, even if maxPoolSize is 5 , why it is creating another 5 conn. in the pool. Is it because of initialPoolSize ?
Thanks
回答1:
it sounds like you have two active pools. are you calling getConnection( user, password ) rather than the default getConnection()? c3p0 creates a distinct pool for each authentication. also, you can follow the number of active authentications via JMX.
initialPoolSize shouldn't have anything much to do with it. also, it's always a good idea, when trying to understand c3p0 issues, to make sure that the active config is what you expect it is. again, you can see most config parameters via JMX, or more simply, check your log files. c3p0 DataSources dump their configuration at INFO upon initialization.
来源:https://stackoverflow.com/questions/13942540/c3p0-connection-pool-queries