Re: Debugging my Connector/J based Tomcat Servlet
"Christopher G. Stach II" <[email protected]> Sun, 12 Jul 2009 14:53:11 -0500 (CDT)
| Newsgroups | gmane.comp.db.mysql.java |
|---|---|
| Message-ID | <[email protected]> |
----- "Niklas Saers" <[email protected]> wrote: > From the code I've inherited it looks like the choice to keep the > connection was to reduce the overhead with establishing the > connection. I agree very much with your suggestion and will implement > > that, but do you know what overhead I'm looking at for opening and > closing these connections when getting them from a pool? Next to zero. The pool keeps a bunch of connections open and the overhead will come from connection assignment and possibly from connection testing to make sure the connection is valid, if you set your pool to test at assignment. (It would simply run something like "SELECT 1" to see if it's good before it hands it out.) If the tested connection is dead, it just moved on to the next one until it finds a live one and opens new ones in the background to keep your minimum number of connections limit satisfied. Proper pool sizing is up to you, though. There are many articles out there on this topic. -- Christopher G. Stach II -- MySQL Java Mailing List For list archives: http://lists.mysql.com/java To unsubscribe: http://lists.mysql.com/[email protected]