tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Fisher <dfis...@jmlafferty.com>
Subject Re: R: How to close idle connections
Date Mon, 28 Apr 2008 15:11:00 GMT

On Apr 28, 2008, at 9:59 AM, Alan Chaney wrote:

>
>
> David Smith wrote:
>>>
>>>
>>> No, I have at most 20 idle connections, that's goes right, but my  
>>> boss want
>>> less idle connections to avoid to overload the database server. So  
>>> there
>>> isn't way to close an idle connection to remove the relative  
>>> process?
>>> If so, I will set maxIdle="2" and everyone will be happy  
>>> (expecially me :)
>>>
>> I'll bet money the added, idle postgres connections are just  
>> sleeping while they wait for work.  Given idle connections  
>> contribute virtually no additional load, don't see his argument  
>> that idle connections contribute to a database overload.  If the  
>> minor increase in overhead due to sleeping threads actually  
>> overloads the database, you need to let your boss know the server  
>> hardware is way too frail for production use and needs to be  
>> upgraded.
>> --David
> Agreed. I use postgres and with ps alx | grep postgres each  
> connection shows as idle (when its not being used!) and consumes  
> about 140k bytes of memory. On a modern server that can hardly be  
> considered as any use at all!

The database server will typically have a maximum number of  
connections. For example our Oracle server has been set at 220 for  
sometime. We do well with a connection pool of 8 per tomcat server.

And with a database server the web side is not the only customer.

maxidle="2" is certainly too small, and maxidle="20" too large.

Enrico I would negotiate with your boss and dba about what that value  
should be. They need to understand the trade-off. The dba may be able  
to increase the number of connections on that end.

Regards,
Dave


>
>
>
> Alan Chaney
>
>
>
>
>> Enrico Sasdelli wrote:
>>> Thanks for reply,
>>>
>>>
>>>> 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.
>>>>
>>>
>>> No, I have at most 20 idle connections, that's goes right, but my  
>>> boss want
>>> less idle connections to avoid to overload the database server. So  
>>> there
>>> isn't way to close an idle connection to remove the relative  
>>> process?
>>> If so, I will set maxIdle="2" and everyone will be happy  
>>> (expecially me :)
>>>
>>>
>>> Thank you,
>>> Enrico
>>>
>>>
>>>
>>>> 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
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>> !DSPAM:4815ddca16721381456296!
>
> ---------------------------------------------------------------------
> 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