public RaftContext(ServerStateManager stateManager, StateMachine stateMachine, RaftParameters raftParameters, RpcListener rpcListener, LoggerFactory logFactory, RpcClientFactory rpcClientFactory, ScheduledThreadPoolExecutor scheduledExecutor){ this.serverStateManager = stateManager; this.stateMachine = stateMachine; this.raftParameters = raftParameters; this.rpcClientFactory = rpcClientFactory; this.rpcListener = rpcListener; this.loggerFactory = logFactory; this.scheduledExecutor = scheduledExecutor; if(this.scheduledExecutor == null){ this.scheduledExecutor = new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors()); } if(this.raftParameters == null){ this.raftParameters = new RaftParameters() .withElectionTimeoutUpper(300) .withElectionTimeoutLower(150) .withHeartbeatInterval(75) .withRpcFailureBackoff(25) .withMaximumAppendingSize(100) .withLogSyncBatchSize(1000) .withLogSyncStoppingGap(100) .withSnapshotEnabled(0) .withSyncSnapshotBlockSize(0); } }
public RaftContext(ServerStateManager stateManager, StateMachine stateMachine, RaftParameters raftParameters, RpcListener rpcListener, LoggerFactory logFactory, RpcClientFactory rpcClientFactory, ScheduledThreadPoolExecutor scheduledExecutor){ this.serverStateManager = stateManager; this.stateMachine = stateMachine; this.raftParameters = raftParameters; this.rpcClientFactory = rpcClientFactory; this.rpcListener = rpcListener; this.loggerFactory = logFactory; this.scheduledExecutor = scheduledExecutor; if(this.scheduledExecutor == null){ this.scheduledExecutor = new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors()); } if(this.raftParameters == null){ this.raftParameters = new RaftParameters() .withElectionTimeoutUpper(300) .withElectionTimeoutLower(150) .withHeartbeatInterval(75) .withRpcFailureBackoff(25) .withMaximumAppendingSize(100) .withLogSyncBatchSize(1000) .withLogSyncStoppingGap(100) .withSnapshotEnabled(0) .withSyncSnapshotBlockSize(0); } }
public RaftContext(ServerStateManager stateManager, StateMachine stateMachine, RaftParameters raftParameters, RpcListener rpcListener, LoggerFactory logFactory, RpcClientFactory rpcClientFactory, ScheduledThreadPoolExecutor scheduledExecutor){ this.serverStateManager = stateManager; this.stateMachine = stateMachine; this.raftParameters = raftParameters; this.rpcClientFactory = rpcClientFactory; this.rpcListener = rpcListener; this.loggerFactory = logFactory; this.scheduledExecutor = scheduledExecutor; if(this.scheduledExecutor == null){ this.scheduledExecutor = new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors()); } if(this.raftParameters == null){ this.raftParameters = new RaftParameters() .withElectionTimeoutUpper(300) .withElectionTimeoutLower(150) .withHeartbeatInterval(75) .withRpcFailureBackoff(25) .withMaximumAppendingSize(100) .withLogSyncBatchSize(1000) .withLogSyncStoppingGap(100) .withSnapshotEnabled(0) .withSyncSnapshotBlockSize(0); } }
.withRpcFailureBackoff(500) .withMaximumAppendingSize(200) .withLogSyncBatchSize(5) .withLogSyncStoppingGap(5) .withSnapshotEnabled(5000)
.withRpcFailureBackoff(500) .withMaximumAppendingSize(200) .withLogSyncBatchSize(5) .withLogSyncStoppingGap(5) .withSnapshotEnabled(5000)