My case is as follow:
I have to maintain a server, with Tomcat(6) as web server, that has a bunch of webapps on it. These webapps are maintained by others. Our server has a connection to another department's DB server, which has information that our webapps need to display. Without proper pooling strategy, our server soon turned to disaster.
Now that I introduce Pooling to everyone (I chose BoneCP - 0.7), we are going to create single pool that stays on Tomcat's global JNDI Context and let everyone get connection from it. That should solve the problem, i guess.
My concern is: How can I fully control this Pooling ? I have some requirements:
I want to reload DataSource configuration at runtime, either manually or programatically (will try to connect to a backup server in the time of need)
Change number of connection (min, max, idle connections) that can change from time to time
Keep Tomcat alive is preferable
I intent to build an alert system that use JMX to connect and retrieve information, and have a button to reload the Pool (I know that all Pooling strategy have some kind of recovering, but the other DB server crash periodically, so restart connections by hand is somewhat preferable).
I think of some possible solutions:
My Question are:
(Why does anyone choose BoneCP? Every question I've ever heard about that involves BoneCP is resolved by the poster switching to another CP and everything works. BoneCP isn't even at v1.0, yet. I guess it's the next big thing. Just hasn't yet arrived.)
Tomcat comes with support for Apache commons-dbcp and Tomcat's own tomcat-pool built-in: just configure your JNDI connection pool as per the Tomcat docs and you're off.
Unfortunately, Tomcat does not currently support a re-load of the DataSource at runtime. You can change properties via JMX, but the changes have no effect. You can also close the pool, but you just end up with a closed pool which is then worthless.
Logging an enhancement in Tomcat's bugzilla would probably be a good thing to do.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With