Comments (2)
Hi,
I understand your concern, but I think your proposed solutions are just
workarounds:
- Add a Bitronix configuration so that the recovery connection acquire
will attempt N times before giving up.
That sounds a bit silly to me. By doing that, you're just pushing harder to
get hold of a scarce resource, if that ever works (which if it does would
be plain luck IMHO) that will simply be detrimental to your other threads
using the connection pool. And since the recoverer already runs
periodically, there is no need to perform any kind of retry within it: when
it fails, it doesn't matter as the next time it runs it will attempt to do
the same work over again.
- Add a Bitronix configuration so that the recovery can use a dedicated
JDBC connection that's never served trough DataSource.getConnection().
Why on earth would you want to do that? You've used your Flexypool tool to
reduce the connections count to a bare minimum to make the most of the
available resources, but now you're thinking about reserving one connection
that will only be used briefly a couple times per minute. Isn't that
counter-productive?
I'm tempted to say that you should simply grow your connection pool's max
connections limit and be done with it.
Ludovic
On Fri, May 9, 2014 at 11:04 AM, Vlad Mihalcea [email protected]:
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 supporthttp://vladmihalcea.com/2014/04/30/professional-connection-pool-sizing/
.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 omittedWhat do you think of having some fail-over options such as:
- Add a Bitronix configuration so that the recovery connection
acquire will attempt N times before giving up.- Add a Bitronix configuration so that the recovery can use a
dedicated JDBC connection that's never served trough
DataSource.getConnection().—
Reply to this email directly or view it on GitHubhttps://github.com//issues/24
.
from btm.
Hi,
It really depends on the connection usage patterns. Thanks for clarifying the recovery behavior. I thought recovery should take precedence over existing transactions.
- The retry is actually happening in the XAPool.getConnectionHandle while(true) loop
that takes keeps on attempting until it hits the timeout threshold. Indeed an extra retry mechanism is useless. - I thought the recovery exceptions require more priority, since we'd like old transactions to be run before many new more arrive.
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
from btm.
Related Issues (20)
- MySQL 8 support HOT 1
- How to configure log4j debug logs for bitrnix
- XAFactories which implement java.util.Map (MQXAConnectionFactory) cannot be initialized properly HOT 3
- Why is there no activity on the Bitronix github? HOT 2
- Using bitronox manager, XA not working with my custom dev-kit adapter HOT 7
- Transaction Manager problem HOT 1
- Glad to see the BTM project active again
- searching best solution for error handling HOT 1
- Error show in tomcat logs HOT 2
- Connection pool unable to recover after database connectivity loss HOT 1
- Question on rollback HOT 1
- Clarify requirements for XAResourceProducer unique name HOT 3
- Support custom XAResourceProducer implementations in ResourceLoader HOT 1
- Transaction Timeout Not working HOT 1
- Using ActiveMQ and bitronix-transaction-manager redelivery issue HOT 1
- Data Security Issue : Vendor property password is getting logged without masking HOT 1
- XA making multiple connections with MQ manager HOT 3
- Is it possible to recover heuristic exception.
- Is it possible to release 3.x?
- Issues related to spring cloud + feign HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from btm.