-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #781 from ctripcorp/feature/rebalance-keeper
Feature/rebalance keeper
- Loading branch information
Showing
27 changed files
with
759 additions
and
457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...java/com/ctrip/xpipe/redis/console/keeper/handler/KeeperContainerPairOverloadHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.ctrip.xpipe.redis.console.keeper.handler; | ||
|
||
import com.ctrip.xpipe.redis.checker.model.KeeperContainerUsedInfoModel; | ||
import com.ctrip.xpipe.redis.console.config.ConsoleConfig; | ||
import com.ctrip.xpipe.redis.console.keeper.entity.IPPairData; | ||
import com.ctrip.xpipe.redis.console.model.KeeperContainerOverloadStandardModel; | ||
|
||
public class KeeperContainerPairOverloadHandler extends AbstractHandler<Object>{ | ||
|
||
private KeeperContainerUsedInfoModel pairA; | ||
|
||
private KeeperContainerUsedInfoModel pairB; | ||
|
||
private ConsoleConfig config; | ||
|
||
private IPPairData ipPairData; | ||
|
||
public KeeperContainerPairOverloadHandler(KeeperContainerUsedInfoModel pairA, KeeperContainerUsedInfoModel pairB, ConsoleConfig config, IPPairData ipPairData) { | ||
this.pairA = pairA; | ||
this.pairB = pairB; | ||
this.config = config; | ||
this.ipPairData = ipPairData; | ||
} | ||
|
||
@Override | ||
protected boolean doNextHandler(Object o) { | ||
double keeperPairOverLoadFactor = config.getKeeperPairOverLoadFactor(); | ||
KeeperContainerOverloadStandardModel minStandardModel = new KeeperContainerOverloadStandardModel() | ||
.setFlowOverload((long) (Math.min(pairB.getInputFlowStandard(), pairA.getInputFlowStandard()) * keeperPairOverLoadFactor)) | ||
.setPeerDataOverload((long) (Math.min(pairB.getRedisUsedMemoryStandard(), pairA.getRedisUsedMemoryStandard()) * keeperPairOverLoadFactor)); | ||
long overloadInputFlow = ipPairData.getInputFlow() - minStandardModel.getFlowOverload(); | ||
long overloadPeerData = ipPairData.getPeerData() - minStandardModel.getPeerDataOverload(); | ||
return overloadInputFlow > 0 || overloadPeerData > 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...n/java/com/ctrip/xpipe/redis/console/keeper/impl/DefaultKeeperContainerAvailablePool.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.ctrip.xpipe.redis.console.keeper.impl; | ||
|
||
public class DefaultKeeperContainerAvailablePool { | ||
} |
Oops, something went wrong.