commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diego Cueva <dcu...@todo1.com>
Subject RE: Metrics for commons DBCP
Date Tue, 02 Aug 2005 20:53:19 GMT
OK thanks:

I am going to try to retrieve the DataSource created by Hibernate, in
this way I can try to cast it to BasicDataSource.

Thanks for your time.

Att.
Diego Cueva.

-----Original Message-----
From: Brian Cook [mailto:bcook@printtime.com] 
Sent: Tuesday, August 02, 2005 15:39
To: Jakarta Commons Users List
Subject: Re: Metrics for commons DBCP


It is coming up zero because your 
org.apache.commons.dbcp.BasicDataSource instance is never being used. 
To use org.apache.commons.dbcp.BasicDataSource you would have to have 
something like :


	BasicDataSource ds = new BasicDataSource();
         ds.setDriverClassName("com.mysql.jdbc.Driver");
         ds.setUsername("userName");
         ds.setPassword("password");
         ds.setUrl(connectURI);
         Connection con = null;
       try {
         con = ds.getConnection();
       }
       catch(Exception a){  ...........  }

The problem here is that every time you create an instance 
BasicDataSource you are creating an entire new pool.  So you can quickly

over run the system number of connections.  As I found out the hard way.

  If you are using JNDI then you are using the DataSource object not the

BasicDataSource object.



Diego Cueva wrote:
> Thanks a lot for your answer, but the result is always 0.
> 
> I am applying your suggestion in this way:
> 
> libre = Runtime.getRuntime().freeMemory();
> total = Runtime.getRuntime().totalMemory();
> usada = total - libre;
> 	
> org.apache.commons.dbcp.BasicDataSource o = new
> org.apache.commons.dbcp.BasicDataSource();
>         
> Log.logEvent("MEM T U L: "+ total + "  "+ usada+ "  "+libre+ 
> " act="+o.getNumActive() + " idl="+o.getNumIdle());
> 		
> But the result is always 0, this is a log extract example from a test
> load:
> 
> 2005-08-02 14:55:23|MEM T U L: 48746496  28956352  19790144 act=0
idl=0
> 2005-08-02 14:55:23|MEM T U L: 48746496  27750072  20996424 act=0
idl=0
> 2005-08-02 14:55:25|MEM T U L: 48746496  25458960  23287536 act=0
idl=0
> 
> I am using commons-dbcpool embedded in Hibernate, with the next
> configuration:
> 
> 	<!--  connection pool -->
> 	<property name="dbcp.maxActive">10</property>
> 	<property name="dbcp.whenExhaustedAction">2</property>
> 	<property name="dbcp.maxWait">20</property>
> 	<property name="dbcp.maxIdle">20</property>
> 
> 	<!-- prepared statement cache -->
> 	<property name="dbcp.ps.maxActive">10</property>
> 	<property name="dbcp.ps.whenExhaustedAction">2</property>
> 	<property name="dbcp.ps.maxWait">20</property>
> 	<property name="dbcp.ps.maxIdle">20</property>
> 
> Att.
> Diego
> 
> -----Original Message-----
> From: Pramodh Peddi [mailto:ppeddi@IMPRIVATA.com] 
> Sent: Tuesday, August 02, 2005 14:17
> To: Jakarta Commons Users List
> Subject: RE: Metrics for commons DBCP
> 
> org.apache.commons.dbcp.BasicDataSource has methods like
getNumActive(),
> getNumIdle(), etc methods.
> 
> Did I answer your question?
> 
> Pramodh.
> 
> -----Original Message-----
> From: Diego Cueva [mailto:dcueva@todo1.com] 
> Sent: Tuesday, August 02, 2005 10:30 AM
> To: 'Jakarta Commons Users List'
> Subject: Metrics for commons DBCP
> 
> Hello:
> 
> Somebody knows how I can know the amounts of DB connections are being
> used in a determinate moment.
> 
> I need this information to carry of a monitoring of my app, part of
> monitoring is know how much connections are free and used.
> 
> Thanks a lot.
> 
> 
> Att.
> 
> Diego
> 
> 
> 
> 
> TODO1 SERVICES, INC. -TODO1- es la propietaria de la información
> contenida
> en este mensaje y sus anexos, que puede tener carácter confidencial y
ha
> sido enviada para uso exclusivo del destinatario intencional. Si usted
> ha
> recibido este mensaje por error, por favor informe de ello al
remitente
> a la
> mayor brevedad y elimine este mensaje y sus anexos. Está prohibido su
> uso,
> distribución, divulgación o almacenamiento, salvo autorización escrita
> de
> TODO1. Todo mensaje enviado y/o recibido por TODO1 es monitoreado por
> motivos operativos y actuando de acuerdo con prácticas de negocio y de
> seguridad legítimas.
> 
> TODO1 SERVICES, INC. -TODO1- is the proprietary of the information
> contained
> herein and its attachments, that may have confidential character and
has
> been sent to the intended recipient only. If you are not the intended
> recipient, please contact the sender immediately by replying to this
> e-mail
> and delete the message and its attachments. The use, forward,
> disclosure,
> record or retention of this message for any purpose whatsoever, is
> strictly
> prohibited, unless prior written authorization from TODO1. E-mails to
> and
> from TODO1 are monitored for operational reasons and in accordance
with
> lawful business and security practices.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 


-- 
Brian Cook
Digital Services Analyst
Print Time Inc.
bcook@printtime.com
913.345.8900



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message