Hi, seems you are rite: org.apache.commons.dbcp.BasicDataSource source = (org.apache.commons.dbcp.BasicDataSource)ds; System.out.println("num of idle connections " + source.getNumIdle() ); System.out.println("num of max act connections " + source.getMaxActive() ); System.out.println("username " + source.getUsername() );
prints: num of idle connections 0 num of max act connections 0 username tomcat but why? here is the connection pool configuration: <Resource name="jdbc/sdb-login" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/sdb-login"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>driverClassName</name> <value>ca.edbc.jdbc.EdbcDriver</value> </parameter> <parameter> <name>poolPreparedStatements</name> <value>true</value> </parameter> <parameter> <name>defaultAutoCommit</name> <value>false</value> </parameter> <parameter> <name>url</name> <value>jdbc:edbc://localhost:IJ7/sdb</value> </parameter> <parameter> <name>username</name> <value>tomcat</value> </parameter> <parameter> <name>password</name> <value>passwd ;-)</value> </parameter> <parameter> <name>initialSize</name> <value>20</value> </parameter> <parameter> <name>maxActive</name> <value>0</value> </parameter> <parameter> <name>maxIdle</name> <value>0</value> </parameter> <parameter> <name>minIdle</name> <value>20</value> </parameter> <parameter> <name>maxWait</name> <value>-1</value> </parameter> <parameter> <name>testOnBorrow</name> <value>false</value> </parameter> </ResourceParams> Thanks for support, Henrik On Fri, 10 Sep 2004 11:51:05 -0400 "Shapira, Yoav" <[EMAIL PROTECTED]> wrote: > > Hi, > Hmm, with minIdle set to 20 and assuming your test gets one connection > at a time (or less than 20 at a time), I'm a bit confused. > > One next step would be to really verify that the pool has available > connections before the get connection call. You obviously wouldn't do > this in a production application, but this is just for debugging a > performance test. Cast the DataSource to the concrete implementation > type, probably org.apache.commons.dbcp.BasicDataSource, and call > getNumIdle on it to verify it's a positive number before calling > getConnection. If it's zero or negative your pool is misconfigured and > you're creating a new connection, hence the slow performance. > > Yoav Shapira > Millennium Research Informatics > > > >-----Original Message----- > >From: Henrik Rathje [mailto:[EMAIL PROTECTED] > >Sent: Friday, September 10, 2004 11:46 AM > >To: Tomcat Users List > >Subject: Re: DBCP Performance? > > > >Hi, > >The minIdle value during this test was: > ><parameter> > > <name>minIdle</name> > > <value>20</value> > ></parameter> > >any other suggestions? > >Thanks in advance, Henrik > > > > > > > >On Fri, 10 Sep 2004 11:21:08 -0400 > >"Shapira, Yoav" <[EMAIL PROTECTED]> wrote: > > > >> > >> Hi, > >> The initial connections can be closed if idle, depending on your pool > >> configuration, so you might be creating new connections each time > even > >> with the pool. Check your minIdle setting. > >> > >> If you're creating a new connection each time, a tiny bit of overhead > >> can be expected for a pool over a direct DriverManager call. But > that > >> defeats the purpose of pooling. If your pool is properly configured > and > >> has a connection waiting, it should be a little bit more than a hash > >> lookup to return the connection, which would be significantly faster > >> than creating a new one. > >> > >> Yoav Shapira > >> Millennium Research Informatics > >> > >> > >> >-----Original Message----- > >> >From: Henrik Rathje [mailto:[EMAIL PROTECTED] > >> >Sent: Friday, September 10, 2004 11:16 AM > >> >To: [EMAIL PROTECTED] > >> >Subject: DBCP Performance? > >> > > >> >Hi, > >> >has enyone of you recently measured the performance of the DBCP > >> >Connection Pool? I compared > >> > > >> ><snip> > >> >long start = System.currentTimeMillis(); > >> >Class.forName("ca.edbc.jdbc.EdbcDriver"); > >> >Connection dbcon = DriverManager.getConnection(loginUrl, loginUser, > >> >loginPa$ > >> >long diff = System.currentTimeMillis() - start; > >> >System.out.println("creating connection without pool took: " + diff > + " > >> >mil$ > >> ></snip> > >> > > >> >with > >> > > >> ><snip> > >> >long start = System.currentTimeMillis(); > >> >Connection dbcon = ds.getConnection( ); > >> >long diff = System.currentTimeMillis() - start; > >> >System.out.println("creating connection with pool took: " + diff + " > >> >milise$ > >> ></snip> > >> > > >> >And got surprisingly results like this: > >> > > >> >creating connection without pool took: 465 miliseconds > >> >creating connection with pool took: 585 miliseconds > >> > > >> >In my tests the connection pool is always slower, so what did I do > >> wrong? > >> >I guess this Parameter is responsible for holding active Connections > in > >> >the Pool: > >> ><parameter> > >> > <name>initialSize</name> > >> > <value>20</value> > >> ></parameter> > >> >So there shold be active Connections before the getConnection( ) is > >> >called .. Any ideas? > >> >Regards, Henrik > >> > > >> > >--------------------------------------------------------------------- > >> >To unsubscribe, e-mail: [EMAIL PROTECTED] > >> >For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > >> > >> > >> This e-mail, including any attachments, is a confidential business > >communication, and may contain information that is confidential, > >proprietary and/or privileged. This e-mail is intended only for the > >individual(s) to whom it is addressed, and may not be saved, copied, > >printed, disclosed or used by anyone else. If you are not the(an) > intended > >recipient, please immediately delete this e-mail from your computer > system > >and notify the sender. Thank you. > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > This e-mail, including any attachments, is a confidential business communication, > and may contain information that is confidential, proprietary and/or privileged. > This e-mail is intended only for the individual(s) to whom it is addressed, and may > not be saved, copied, printed, disclosed or used by anyone else. If you are not > the(an) intended recipient, please immediately delete this e-mail from your computer > system and notify the sender. Thank you. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]