commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz" <phil.ste...@gmail.com>
Subject Re: maxActive/maxWait
Date Wed, 05 Mar 2008 05:18:56 GMT
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
View raw message