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.handlermigration.HandlerBalancer
tries to detect such situations and fix
them by moving
ReadHandler
and
WriteHandler
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
GroupProperties.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.