-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recovery thread connection acquiring enhancement #24
Comments
Hi, I understand your concern, but I think your proposed solutions are just
That sounds a bit silly to me. By doing that, you're just pushing harder to
Why on earth would you want to do that? You've used your Flexypool tool to I'm tempted to say that you should simply grow your connection pool's max Ludovic On Fri, May 9, 2014 at 11:04 AM, Vlad Mihalcea [email protected]:
|
Hi, It really depends on the connection usage patterns. Thanks for clarifying the recovery behavior. I thought recovery should take precedence over existing transactions.
My idea was not to always hold a db connection for recovery. I thought of allowing recovery to open an extra connection when it can't get one from the pool. Since it's just one connection per DataSource, that won't have a huge impact on the whole connection usage pattern. When the recovery is done, the connection could be simply closed. But since the recovery is a periodic process, it can simply succeed when the traffic spike is over. Growing the pool is an easy solution but it's challenging when you have a limited number of db nodes (1 master, 1 slave) and a great deal of db consuming apps (web nodes, schedulers, batch processors), all competing for the limited db connections. Now if we consider a cloud auto scaling feature (that adds app nodes on demand) you can understand my worries. Even if we can always add slave(read-only) nodes, for a master-slave environment you might be stuck with a single master(write) node. That's why you want your apps to strive for a lower connection pool size, so techniques like lowering transaction durations help a lot. Vlad |
In our current enterprise system we've been struggling to lower the poolingDataSource.acquisitionTimeout from the default 30s to some more appropriate value (1-5s).
For "classic" DataSource.getConnection() scenarios it was possible, thanks to using FlexyPool BTM support.
The only problem is the recovery thread, since we cannot intercept the time-out exceptions and there is no default retrying mechanisms or the possibility for using a separate connection from the regular pooled connections.
So we get:
bitronix.tm.recovery.RecoveryException: cannot start recovery on a PoolingDataSource containing an XAPool of resource dtfDataSource with 7 connection(s) (0 still available)
at bitronix.tm.resource.jdbc.PoolingDataSource.startRecovery(PoolingDataSource.java:288) ~[btm-2.1.3.jar:2.1.3]
at bitronix.tm.recovery.Recoverer.recover(Recoverer.java:258) [btm-2.1.3.jar:2.1.3]
at bitronix.tm.recovery.Recoverer.recoverAllResources(Recoverer.java:226) [btm-2.1.3.jar:2.1.3]
at bitronix.tm.recovery.Recoverer.run(Recoverer.java:142) [btm-2.1.3.jar:2.1.3]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_45]
Caused by: bitronix.tm.internal.BitronixRuntimeException: XA pool of resource dtfDataSource still empty after 1s wait time
at bitronix.tm.resource.common.XAPool.waitForConnectionInPool(XAPool.java:423) ~[btm-2.1.3.jar:2.1.3]
at bitronix.tm.resource.common.XAPool.getInPool(XAPool.java:374) ~[btm-2.1.3.jar:2.1.3]
at bitronix.tm.resource.common.XAPool.getConnectionHandle(XAPool.java:123) ~[btm-2.1.3.jar:2.1.3]
at bitronix.tm.resource.jdbc.PoolingDataSource.startRecovery(PoolingDataSource.java:284) ~[btm-2.1.3.jar:2.1.3]
... 4 common frames omitted
What do you think of having some fail-over options such as:
The text was updated successfully, but these errors were encountered: