Re: should i leave a connection open?
Posted by: Mark Matthews
Date: June 30, 2005 05:31PM

Joost Schouten wrote:
> Use a connection pool and have the pool decide
> whether to leave it open. Opening and closing a
> connection takes a lot of overhead, so in your
> case leaving it open is usually better.

Not the case w/ MySQL. It's only a few ms. to open a connection.

>
> Having said that, you will need to have a system
> (connection pool) in place which makes sure your
> connections are not left open for too long and
> will reap idle connections. Cause if you don't
> monitor your open connections there is a increased
> danger of memory leaks and inefficient connection
> usage.

You shouldn't open them _needlessly_, but having them sit idle for more than a few minutes is usually a waste.

Our "take" on this is in the Connector/J manual:

http://dev.mysql.com/doc/connector/j/en/cj-connection-pooling.html

-Mark

Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools
Oracle
http://www.mysql.com/products/enterprise/monitor.html

Options: ReplyQuote


Subject
Written By
Posted
Re: should i leave a connection open?
June 30, 2005 05:31PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.