1

[BoneCP Version : 0.8.0.RELEASE]
[Guava Version : 11.0.2]

I am using guice-mybatis with bonecp as datasource-provider. I have wrapped the MySQL driver with getConnection() over-ridden in order to rotate across mysql master and slave. I see boneCP is creating too many connections than required by application. Considering the QPS we have 10 active connections should have been enough but it is creating more than 30. Also, bonecp stats are giving negative numbers :

[Format]
Cluster = pool.getTotalCreatedConnections()|pool.getTotalFree()|pool.getTotalLeased() 

[ Data ]
cluster[1]=10|44|-34,
cluster[2]=10|50|-40,
cluster[3]=-28|0|-28,
cluster[4]=10|45|-35,
cluster[5]=10|49|-39,
cluster[6]=10|50|-40,
cluster[7]=10|46|-36,
cluster[8]=10|34|-24,


Following are my bonecp configurations :
        bonecp.connectionTestStatement = "SELECT now()"
        bonecp.partitionCount = 1
        bonecp.maxConnectionsPerPartition = 50
        bonecp.minConnectionsPerPartition = 10
        bonecp.acquireIncrement = 1
        bonecp.idleConnectionTestPeriod = 60
        bonecp.timeUnit = SECONDS
        bonecp.idleMaxAge = 10
        bonecp.poolAvailabilityThreshold = 1
        bonecp.maxConnectionAgeInSeconds = 10
        bonecp.acquireRetryDelayInMs = 500
        bonecp.acquireRetryAttempts = 10

From the netstat I see the total number of ESTABLISHED connections are equal to sum of pool.getTotalFree() of all clusters.

NOTE: I have another db [oracle] for which I am using bonecp without facing this problem. Only difference is we haven't wrapped the driver, and there doesn't need to do rotation across different hosts for getConnection() request.

I was using C3P0 before moving to BoneCP, where we were facing performance issues, but stats were fine. I am reading the source-code to identify the root cause.

Frank Pavageau
  • 11,477
  • 1
  • 43
  • 53

0 Answers0