java - Why sleep mode coonections are not reused by c3p0? -


i develop web application using spring mvc + mysql. manage jdbc connection used c3p0 connection pooling.

if using c3p0, suppose if, 5 connections open in pool , 5 connections in sleep mode , if request getconnection() java 1 of them should returned connection. correct?

if yes consider following load testing scenario getting exception connections not acquired underlying database!. using jmeter started load test 250 users in 15 seconds. m continuously observing db connections using shoe full processlist first minutes going 250 users thrown web server connections count reached 500 our maxpoolsize. after getting connections not acquired underlying database!.

at point if execute shoe full processlist can see 500 connections in sleep mode if correct in above statement open connection in sleep mode returned c3p0. why getting exception.?

here c3p0 properties

minpoolsize=10 acquireincrement=1 maxpoolsize=500 initialpoolsize=10 numberhelperthread=100 maxidletime=10 maxstatement=20 maxstatementperconnection=5 idleconnectiontestperiod=120 acquireretryattempt=10 acquireretrydelay=100 autocommitonclose=false breakafteracquirefailure=false testconnectiononcheckout=true testconnectiononcheckin=true 

update

i found warning before connections not acquired underlying database! exception

warn : 30 jun 2014 10:40:12.078 com.mchange.v2.resourcepool.basicresourcepool$scatteredacquiretask.run(basicresourcepool.java:1839) - com.mchange.v2.resourcepool.basicresourcepool$scatteredacquiretask@e49561 -- acquisition attempt failed!!! clearing pending acquires. while trying acquire needed new resource, failed succeed more maximum number of allowed acquisition attempts (10). last acquisition attempt exception:   com.mysql.jdbc.exceptions.jdbc4.mysqlnontransientconnectionexception: many connections     @ sun.reflect.nativeconstructoraccessorimpl.newinstance0(native method)     @ sun.reflect.nativeconstructoraccessorimpl.newinstance(unknown source)     @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(unknown source)     @ java.lang.reflect.constructor.newinstance(unknown source)     @ com.mysql.jdbc.util.handlenewinstance(util.java:411)     @ com.mysql.jdbc.util.getinstance(util.java:386)     @ com.mysql.jdbc.sqlerror.createsqlexception(sqlerror.java:1015)     @ com.mysql.jdbc.mysqlio.checkerrorpacket(mysqlio.java:4187)     @ com.mysql.jdbc.mysqlio.checkerrorpacket(mysqlio.java:4119)     @ com.mysql.jdbc.mysqlio.checkerrorpacket(mysqlio.java:927)     @ com.mysql.jdbc.mysqlio.proceedhandshakewithpluggableauthentication(mysqlio.java:1709)     @ com.mysql.jdbc.mysqlio.dohandshake(mysqlio.java:1252)     @ com.mysql.jdbc.connectionimpl.coreconnect(connectionimpl.java:2483)     @ com.mysql.jdbc.connectionimpl.connectonetryonly(connectionimpl.java:2516)     @ com.mysql.jdbc.connectionimpl.createnewio(connectionimpl.java:2301)     @ com.mysql.jdbc.connectionimpl.<init>(connectionimpl.java:834)     @ com.mysql.jdbc.jdbc4connection.<init>(jdbc4connection.java:47)     @ sun.reflect.generatedconstructoraccessor18.newinstance(unknown source)     @ sun.reflect.delegatingconstructoraccessorimpl.newinstance(unknown source)     @ java.lang.reflect.constructor.newinstance(unknown source)     @ com.mysql.jdbc.util.handlenewinstance(util.java:411)     @ com.mysql.jdbc.connectionimpl.getinstance(connectionimpl.java:416)     @ com.mysql.jdbc.nonregisteringdriver.connect(nonregisteringdriver.java:346)     @ com.mchange.v2.c3p0.drivermanagerdatasource.getconnection(drivermanagerdatasource.java:134)     @ com.mchange.v2.c3p0.wrapperconnectionpooldatasource.getpooledconnection(wrapperconnectionpooldatasource.java:183)     @ com.mchange.v2.c3p0.wrapperconnectionpooldatasource.getpooledconnection(wrapperconnectionpooldatasource.java:172)     @ com.mchange.v2.c3p0.impl.c3p0pooledconnectionpool$1pooledconnectionresourcepoolmanager.acquireresource(c3p0pooledconnectionpool.java:188)     @ com.mchange.v2.resourcepool.basicresourcepool.doacquire(basicresourcepool.java:1074)     @ com.mchange.v2.resourcepool.basicresourcepool.doacquireanddecrementpendingacquireswithinlockonsuccess(basicresourcepool.java:1061)     @ com.mchange.v2.resourcepool.basicresourcepool.access$800(basicresourcepool.java:32)     @ com.mchange.v2.resourcepool.basicresourcepool$scatteredacquiretask.run(basicresourcepool.java:1798)     @ com.mchange.v2.async.threadpoolasynchronousrunner$poolthread.run(threadpoolasynchronousrunner.java:636) warn : 30 jun 2014 10:40:12.078 com.mchange.v2.resourcepool.basicresourcepool.forcekillacquires(basicresourcepool.java:882) - having failed acquire resource, com.mchange.v2.resourcepool.basicresourcepool@1035ff9 interrupting threads waiting on resource check out. try again in response new client requests. 


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -