commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Purnima Venkatram" <purnima.venkat...@gmail.com>
Subject Re: maxActive/maxWait
Date Wed, 05 Mar 2008 16:55:58 GMT
Thanks a lot Phil ! It finally worked with all parameter permutations :).

I tested with maxActive=50 and maxIdle=-1.
With maxWait=1 , for 51 simultaneous requests, it failed for one request.
For subsequent runs, it succeeds.

The same with maxWait=1000, works for 51 connections and goes till the
Tomcat limit of 250 connections. Checked this by increasing Tomcat's limit
of threads.

Also, tomcat 5.5.25 bundles all the necessary functionality in
naming-dbcp.jar (commons-collections,commons-pool,commons-dbcp). Hence,
nothing more is required as a jar. Only in the datasource for factory="
org.apache.commons.dbcp.BasicDataSourceFactory" we need to give
org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory".

I finally set the paramters to maxActive=70 , maxIdle=-1 , maxWait=1000 ,
initialSize=10.

Thanks a lot again for all the help !

Regards,
Purnima.




On Wed, Mar 5, 2008 at 10:48 AM, Phil Steitz <phil.steitz@gmail.com> wrote:

> On Tue, Mar 4, 2008 at 6:09 AM, Purnima Venkatram
> <purnima.venkatram@gmail.com> wrote:
> > Hi Phil.
> >
> >  There still seems to be some problem with maxActive and maxWait.
> >
> >  I changed the approach that I was using and used the context lookup
> >  mechanism
> >
> >  Snippet
> >  ==========================================
> >
> >   ctx = new InitialContext();
> >             if(ctx == null )
> >                 throw new Exception("Boom - No Context");
> >
> >             System.out.println("Context : "+ctx);
> >
> >             ds =
> >                 (DataSource)ctx.lookup(
> >                 "java:/comp/env/jdbc/XYZ");
> >
> >             if (ds != null) {
> >                 conn = ds.getConnection();
> >
> >
> >                 if(conn != null)  {
> >                     name = "Got Connection "+conn.toString();
> >                     Statement stmt = conn.createStatement();
> >                     ResultSet rst =
> >                         stmt.executeQuery(
> >                         "select xyz from abc where xyz=1");
> >                     if(rst.next()) {
> >                         id = rst.getLong(1);
> >                     }
> >                     conn.close();
> >                 }
> >             }
> >
> >  =================================================
> >
> >  Get and print this from a jsp.
> >
> >  Tested with Jmeter:
> >
> >  maxActive=100 maxWait=0 maxIdle=0
>
> Sorry I did not notice this before, but maxIdle = 0 means no object
> can sit idle in the pool, so connections are going to be closed when
> they are returned to the pool.  Either set this to a negative value
> for no limit, leave it at the default (8), or set it to some
> reasonable positive number.
>
> IIRC, "show status" from MySql will display the total number of
> threads and also how many connections have been opened.
>
> Phil
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message