Mail Archive Home | enhydra List | Febuary 2004 Index
| <-- Date Index --> | <-- Thread Index --> |
Hi! We are using Enydra-5.0 at the office for our services and products. We find a "problem" with the way the DBpool work. I will explain it as i have understood it.First the DBPool work based in the asumption that an open DBConnection should only be closed if something wrong happened using it (SQLException). If nothing wrong happened when using the connection when you call the release() mehtod on the DBConnection it will not be closed but put back to the pool waiting to be used. This way the pool will only close DBConnection that cant be trusted. This have nothing wrong at all but if for some reason an application that usually use 10 DBConnection is forced to open 50, a lot of them will stay at the pool and never be used. They will just waste resources at the aplication and the database. This is something really easy to happen when the db is used by more than one application and the database is on heavy load during just a few seconds per day. When this happen you can have hundreds of DBConnections open and only a few used.
To solve this "problem" i made a patch that allow de pool to choose to close a "good" connection because it has already too many connections waiting to be used. This way you can control the pool to keep just enough connections needed to handle a burst but avoid wasting resources. I also added support to read the value of maximum number of DBConnections waiting from the configuration file.
If someone think that this can be usefull let me know. Regards. João Paulo RibeiroPS: below is a diff of the com.lutris.appserver.server.sql.standard.StandardConnectionAllocator to apply the patch. I will send another mail about the same problem with the 5.1.7 dods version and to discuss the change made the pool: stack to linkedlist
diff StandardConnectionAllocator.java.old StandardConnectionAllocator.java -b
189a190,194 > /** JP Patch > * Maximum number of DBConnections that will be waiting in the pool > */ > protected int maxWaitingConnections; > 246a252> maxWaitingConnections = conConfig.getInt("MaxWaitingConnections", 10);
350c356
< || dbConnection.isMarkedForDrop()) {
---
> || dbConnection.isMarkedForDrop() || pool.size() >=
maxWaitingConnections) {
| <-- Date Index --> | <-- Thread Index --> |
Powered by MHonArc.
Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.