The Artima Developer Community
Sponsored Link

Java Buzz Forum
Connection Timebombs instead of Pools?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Russell Beattie

Posts: 727
Nickname: rbeattie
Registered: Aug, 2003

Russell Beattie is a Mobile Internet Developer
Connection Timebombs instead of Pools? Posted: Apr 15, 2004 5:47 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Russell Beattie.
Original Post: Connection Timebombs instead of Pools?
Feed Title: Russell Beattie Notebook
Feed URL: http://www.russellbeattie.com/notebook/rss.jsp?q=java,code,mobile
Feed Description: My online notebook with thoughts, comments, links and more.
Latest Java Buzz Posts
Latest Java Buzz Posts by Russell Beattie
Latest Posts From Russell Beattie Notebook

Advertisement
Something that Anthony reported from the MySQL conference really struck me yesterday:
MySQL connection setup is very fast and therefore Mark recommends not creating more connections than necessary when pooling. The only use for pooling when dealing with MySQL is to throttle and limit the number of connections available to one particular server.
Umm. Wow.

This changes my mind about a lot of things. I've been battling with db pooling since switchign to Tomcat. (That and character sets - what a pain in the ass). So if this is taken at face value - you could just ditch pooling all together? That'd definitely be nice from a Tomcat standpoint.

But what about timeouts? If you forget to do a conn.close() MySQL can hang on to that connection for a *long* time (i.e. forever). How about overriding the Connection object with a facade that sets off a monitoring thread every time one is created. The thread is simply a timebomb: Set the max connection limit and if the connection is open longer than that, it closes itself.

So if your site gets slammed, it opens up 400 connections. Okay. Then when the site is slower, it opens up less. Any connecitons left open for too long automatically blow up.

Sounds like a plan... I'll have to look into it.

-Russ

Read: Connection Timebombs instead of Pools?

Topic: Gentle.NET - An Object Persistence Framework Previous Topic   Next Topic Topic: Debugging HashMap/HashSet

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use