FlexyPool 2 has been released


I’m happy to announce you that FlexyPool 2 has just been released!

FlexyPool 2 released

I started FlexyPool in 2014 because, at the time, I was working as a software architect on a large real-estate platform and we were about to launch the system into production. Because the system was split into multiple modules, we needed a way to figure out the right pool size for each module.

To make matters worse, the front-end nodes could be auto-scaled, so we needed monitoring and same fallback mechanisms in case our initial assumptions did not hold anymore.

And that’s how FlexyPool was born.

Continue reading “FlexyPool 2 has been released”

How does FlexyPool support both Connection proxies and decorators


FlexyPool monitors connection pool usage and so it needs to intercept the connection close method call.
For simplicity sake, the first version was relying on dynamic proxies for this purpose:

private static class ConnectionInvocationHandler 
    implements InvocationHandler {

    public static final String CLOSE_METHOD_NAME = "close";

    private final Connection target;
    private final ConnectionCallback callback;

    public ConnectionInvocationHandler(
        Connection target, 
        ConnectionCallback callback) {
        this.target = target;
        this.callback = callback;

    public Object invoke(
        Object proxy, 
        Method method, 
        Object[] args) throws Throwable {
        if (CLOSE_METHOD_NAME.equals(method.getName())) {
        return method.invoke(target, args);

As straightforward as it may be, a proxy invocation is slower than a decorator, which calls the target method using a direct invocation.
Because all connection pools use proxies anyway, adding another proxy layer only adds more call-time overhead and so now FlexyPool supports connection decorators as well.

Continue reading “How does FlexyPool support both Connection proxies and decorators”

Professional connection pool sizing with FlexyPool


I previously wrote about the benefits of connection pooling and why monitoring it is of crucial importance. This post will demonstrate how FlexyPool can assist you in finding the right size for your connection pools.

Know your connection pool

The first step is to know your connection pool settings. My current application uses XA transactions, therefore we use Bitronix transaction manager, which comes with its own connection pooling solution.

Accord to the Bitronix connection pool documentation we need to use the following settings:

  • minPoolSize: the initial connection pool size
  • maxPoolSize: the maximum size the connection pool can grow to
  • maxIdleTime: the maximum time a connection can remain idle before being destroyed
  • acquisitionTimeout: the maximum time a connection request can wait before throwing a timeout. The default value of 30s is way too much for our QoS

Continue reading “Professional connection pool sizing with FlexyPool”

FlexyPool, reactive connection pooling


When I started working on enterprise projects we were using J2EE and the pooling data source was provided by the application server.


Scaling up meant buying more powerful hardware to support the increasing request demand. The vertical scaling meant that for supporting more requests, we would have to increase the connection pool size accordingly.

Horizontal scaling

Our recent architectures shifted from scaling up to scaling out. So instead of having one big machine hosting all our enterprise services, we now have a distributed service network.


This has numerous advantages:

  • Each JVM is tuned according to the hosted service intrinsic behaviour. Web nodes employ the concurrent low pause collector, while batch services use the throughput collector
  • Deploying a batch service doesn’t affect the front services
  • If one service goes down it won’t affect the rest

Continue reading “FlexyPool, reactive connection pooling”