tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: How to close idle connections
Date Mon, 28 Apr 2008 12:47:26 GMT
I see you have maxIdle="20".  Do you have more that 20 connections 
sitting idle?  Is this really that much of a concern?  As long as the 
connections are released (closed) and returned to the pool, I don't see 
the problem. 

The entire idea of a connection pool is the system keeps around a set of 
idle connections for borrow.  When you code get's a connection, it comes 
from the pool of idle connections and returned when you close the 
connection.  This speeds up your application by elliminating the 
overhead of contacting the server and constructing a new connection 
whenever you call for one.  The pool just grabs a pre-made one off the 
shelf for you.

--David

Enrico Sasdelli wrote:

>Hi all,
>I use tomcat-6.0.14 and postgresql-8.1 with JNDI connection pool, after a
>while, my web application (written in Java/JSP), creates many database
>connections and postgres processes.
>But all of these connections are signed as "Idle", I want to close this idle
>connections to avoid getting to get many postrgres processes.
>So, is there a way to tells tomcat to close an Idle connection after some
>time of inactivity?
>
>At the state of the art, I close the connections, statements and resultsets
>in the finally {} blocks, I use JNDI context resource to get the connection
>and this is my context.xml:
>
><?xml version="1.0" encoding="UTF-8"?>
><Context path="/ManodoriSite">
><Resource name="jdbc/mydb" auth="Container" type="javax.sql.DataSource"
>               maxActive="100" maxIdle="20" maxWait="10000"
>               removeAbandoned="true"
>               removeAbandonedTimeout="60"
>               logAbandoned="true"
>               username="myUser" password="myPassword"
>driverClassName="org.postgresql.Driver"
>               url="jdbc:postgresql://databaseHost/database"/>
></Context>
>
>I've already read tons of documentation, from the official site, google and
>searched through the mailing list archive but I haven't found answer.
>
>Many thanks!
>
>Enrico
>
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>  
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message