com.hazelcast.nio.tcp.handlermigration
Class IOBalancer

java.lang.Object
  extended by com.hazelcast.nio.tcp.handlermigration.IOBalancer

public class IOBalancer
extends Object

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.


Constructor Summary
IOBalancer(InSelectorImpl[] inSelectors, OutSelectorImpl[] outSelectors, HazelcastThreadGroup threadGroup, int migrationIntervalSeconds, LoggingService loggingService)
           
 
Method Summary
 void connectionAdded(Connection connection)
           
 void connectionRemoved(Connection connection)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOBalancer

public IOBalancer(InSelectorImpl[] inSelectors,
                  OutSelectorImpl[] outSelectors,
                  HazelcastThreadGroup threadGroup,
                  int migrationIntervalSeconds,
                  LoggingService loggingService)
Method Detail

connectionAdded

public void connectionAdded(Connection connection)

connectionRemoved

public void connectionRemoved(Connection connection)

stop

public void stop()

start

public void start()


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.