It attempts to detect and fix a selector imbalance problem.
By default Hazelcast uses 3 threads to read data from TCP connections and 3 threads to write data to connections.
We have measured significant fluctuations of performance when the threads are not utilized equally.
com.hazelcast.nio.tcp.iobalancer.HandlerBalancer
tries to detect such situations and fix
them by moving
NonBlockingSocketReader
and
NonBlockingSocketWriter
between
threads.
It measures number of events serviced by each handler in a given interval and if imbalance is detected then it
schedules handler migration to fix the situation. The exact migration strategy can be customized via
MigrationStrategy
.
Measuring interval can be customized via
GroupProperty.IO_BALANCER_INTERVAL_SECONDS
It doesn't leverage
ConnectionListener
capability
provided by
ConnectionManager
to observe connections as it has to be notified
right after a physical TCP connection is created whilst
ConnectionListener
is notified only
after a successful (Hazelcast) binding process.