com.hazelcast.spi.impl.operationservice.impl
Class BackpressureRegulator

java.lang.Object
  extended by com.hazelcast.spi.impl.operationservice.impl.BackpressureRegulator

public class BackpressureRegulator
extends Object

The BackpressureRegulator is responsible for regulating invocation 'pressure'. If it sees that the system is getting overloaded, it will apply back pressure so the the system won't crash.

The BackpressureRegulator is responsible for regulating invocation pressure on the Hazelcast system to prevent it from crashing on overload. Most Hazelcast invocations on Hazelcast are simple; you do (for example) a map.get and you wait for the response (synchronous call) so you won't get more requests than you have threads.

But if there is no balance between the number of invocations and the number of threads, then it is very easy to produce more invocations that the system can handle. To prevent the system crashing under overload, back pressure is applied so that the invocation pressure is bound to a certain maximum and can't lead to the system crashing.

The BackpressureRegulator needs to be hooked into 2 parts:

  1. when a new invocation is about to be made. If there are too many requests, then the invocation is delayed until there is space or eventually a timeout happens and the HazelcastOverloadException is thrown.
  2. when asynchronous backups are made. In this case, we rely on periodically making the async backups sync. By doing this, we force the invocation to wait for operation queues to drain and this prevents them from getting overloaded.


Constructor Summary
BackpressureRegulator(GroupProperties properties, ILogger logger)
           
 
Method Summary
 boolean isSyncForced(BackupAwareOperation backupAwareOp)
          Checks if a sync is forced for the given BackupAwareOperation.
 CallIdSequence newCallIdSequence()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BackpressureRegulator

public BackpressureRegulator(GroupProperties properties,
                             ILogger logger)
Method Detail

newCallIdSequence

public CallIdSequence newCallIdSequence()

isSyncForced

public boolean isSyncForced(BackupAwareOperation backupAwareOp)
Checks if a sync is forced for the given BackupAwareOperation.

Once and a while for every BackupAwareOperation with one or more async backups, these async backups are transformed into a sync backup. For UrgentSystemOperation no sync will be forced.

Parameters:
backupAwareOp - The BackupAwareOperation to check.
Returns:
true if a sync needs to be forced, false otherwise.


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