Get this, dbcp doc
https://commons.apache.org/proper/commons-dbcp/configuration.html is quite
technical I agree but also relatively powerful. In TomEE we can switch the
pool (to use bonecp, tomcat dbcp or your custom one) so if there is one you
prefer you just need to write 1 class to integrate it with tomee and no
need to have  headache trying to adapt 2 configs designed differently :).

That said if I update my test to set your values the behavior is fine, not
sure if it is linked to the fact TomEE 7 uses dbcp2 or not, can be since it
has been quite heavily refactored.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-10-22 14:39 GMT+02:00 iannuz <[email protected]>:

> In my long post I show the effect of *same code* running with 3 different
> types of datasource definition in tomee.xml
>
> *First one* is connection pooling with NO XA
> *Second one* is connection pooling with XA
>
> In both cases I set:
> maxActive=15
> maxIdle=5
> minIdle=3
>
> In *third case* I have connection pooling with XA but with:
> maxActive=15
> maxIdle absent or =15
> minIdle=3 (optional since result is the same)
>
>
> In *first case* the number of connections opened towards mysql is never
> bigger than 15, even if 300 threads around.
> And if number of threads is reduced to 0 the number of connections shrinks
> to 3.
> As I also said in that post the meaning of minIdle and maxIdle as described
> in the web pages I have seen is not of great help. But I was happy enough
> to
> see the number of connections shrinking if not actively used.
>
> In *second case* the pool leaks connections, I could see the number of
> connections opened towards mysql being even bigger than the number of
> threads.. apparently not having any meaningful upper limit.
>
> In *third case* the number of connections remains limited (<=maxActive),
> but
> no shrinking if no workload.
>
> All just switching the datasource definition and parameters in tomee.xml
>
> My interpretation of the following:
> MaxActive: "The maximum number of active connections that can be *allocated
> *from this pool at the same time, or a negative number for no limit."
> MaxIdle: "The maximum number of connections that can *remain *idle in the
> pool, without extra ones being released, or a negative number for no
> limit."
> MinIdle: "The minimum number of connections that can *remain *idle in the
> pool, without extra ones being created, or zero to create none."
> (from http://tomee.apache.org/datasource-config.html)
> is:
> MaxActive: "If != -1 then it is the maximum number of connections that can
> be *allocated *by the pool, meaning that the number of connection between
> my
> app and mysql *should never pass this number*"
> MaxIdle: "If !=-1 it is the number of connections that the pool should keep
> open even if no workload"
> MinIdle: "I wish someone could explain me what this is for" (maybe used to
> decide if idle connections that become invalid should be replaced or not)
>
> And in *case one* I have seen the test app behaving according to my
> expectations just with MinIdle having the efffect I expected from MaxIdle.
>
> So yes, I am quite confused.
> In Websphere I was used to: Maximum connections (never more than this),
> Minimum connections (never less than this), Unused timeout (time after
> which
> a connection can be closed if not used and if at least "Minimum
> connections"
> remain around)
>
> :)
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/org-apache-openejb-resource-jdbc-dbcp-BasicManagedDataSource-allocating-more-than-MaxActive-connectis-tp4676508p4676558.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Reply via email to