Merge pull request #2019 from etschannen/feature-remote-load-balance
The Load balancing algorithm will use remote replicas when the primary is overloaded
This commit is contained in:
commit
fff0d37595
|
@ -202,8 +202,10 @@ Future< REPLY_TYPE(Request) > loadBalance(
|
|||
double nextMetric = 1e9;
|
||||
double bestTime = 1e9;
|
||||
double nextTime = 1e9;
|
||||
int badServers = 0;
|
||||
|
||||
for(int i=0; i<alternatives->size(); i++) {
|
||||
if(bestMetric < 1e8 && i == alternatives->countBest()) {
|
||||
if(badServers < std::min(i, FLOW_KNOBS->LOAD_BALANCE_MAX_BAD_OPTIONS + 1) && i == alternatives->countBest()) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -213,6 +215,9 @@ Future< REPLY_TYPE(Request) > loadBalance(
|
|||
if(now() > qd.failedUntil) {
|
||||
double thisMetric = qd.smoothOutstanding.smoothTotal();
|
||||
double thisTime = qd.latency;
|
||||
if(FLOW_KNOBS->LOAD_BALANCE_PENALTY_IS_BAD && qd.penalty > 1.001) {
|
||||
++badServers;
|
||||
}
|
||||
|
||||
if(thisMetric < bestMetric) {
|
||||
if(i != bestAlt) {
|
||||
|
@ -228,7 +233,11 @@ Future< REPLY_TYPE(Request) > loadBalance(
|
|||
nextMetric = thisMetric;
|
||||
nextTime = thisTime;
|
||||
}
|
||||
} else {
|
||||
++badServers;
|
||||
}
|
||||
} else {
|
||||
++badServers;
|
||||
}
|
||||
}
|
||||
if( nextMetric > 1e8 ) {
|
||||
|
|
|
@ -177,7 +177,7 @@ ServerKnobs::ServerKnobs(bool randomize, ClientKnobs* clientKnobs) {
|
|||
init( MAX_TEAMS_PER_SERVER, 5*DESIRED_TEAMS_PER_SERVER );
|
||||
init( DD_SHARD_SIZE_GRANULARITY, 5000000 );
|
||||
init( DD_SHARD_SIZE_GRANULARITY_SIM, 500000 ); if( randomize && BUGGIFY ) DD_SHARD_SIZE_GRANULARITY_SIM = 0;
|
||||
init( DD_MOVE_KEYS_PARALLELISM, 20 ); if( randomize && BUGGIFY ) DD_MOVE_KEYS_PARALLELISM = 1;
|
||||
init( DD_MOVE_KEYS_PARALLELISM, 15 ); if( randomize && BUGGIFY ) DD_MOVE_KEYS_PARALLELISM = 1;
|
||||
init( DD_MERGE_LIMIT, 2000 ); if( randomize && BUGGIFY ) DD_MERGE_LIMIT = 2;
|
||||
init( DD_SHARD_METRICS_TIMEOUT, 60.0 ); if( randomize && BUGGIFY ) DD_SHARD_METRICS_TIMEOUT = 0.1;
|
||||
init( DD_LOCATION_CACHE_SIZE, 2000000 ); if( randomize && BUGGIFY ) DD_LOCATION_CACHE_SIZE = 3;
|
||||
|
@ -349,8 +349,8 @@ ServerKnobs::ServerKnobs(bool randomize, ClientKnobs* clientKnobs) {
|
|||
init( RATEKEEPER_FAILURE_TIME, 1.0 );
|
||||
init( REPLACE_INTERFACE_DELAY, 60.0 );
|
||||
init( REPLACE_INTERFACE_CHECK_DELAY, 5.0 );
|
||||
init( COORDINATOR_REGISTER_INTERVAL, 30.0 );
|
||||
init( CLIENT_REGISTER_INTERVAL, 300.0 );
|
||||
init( COORDINATOR_REGISTER_INTERVAL, 5.0 );
|
||||
init( CLIENT_REGISTER_INTERVAL, 600.0 );
|
||||
|
||||
init( INCOMPATIBLE_PEERS_LOGGING_INTERVAL, 600 ); if( randomize && BUGGIFY ) INCOMPATIBLE_PEERS_LOGGING_INTERVAL = 60.0;
|
||||
init( EXPECTED_MASTER_FITNESS, ProcessClass::UnsetFit );
|
||||
|
@ -417,8 +417,8 @@ ServerKnobs::ServerKnobs(bool randomize, ClientKnobs* clientKnobs) {
|
|||
|
||||
init( MAX_TPS_HISTORY_SAMPLES, 600 );
|
||||
init( NEEDED_TPS_HISTORY_SAMPLES, 200 );
|
||||
init( TARGET_DURABILITY_LAG_VERSIONS, 200e6 );
|
||||
init( TARGET_DURABILITY_LAG_VERSIONS_BATCH, 100e6 );
|
||||
init( TARGET_DURABILITY_LAG_VERSIONS, 350e6 ); // Should be larger than STORAGE_DURABILITY_LAG_SOFT_MAX
|
||||
init( TARGET_DURABILITY_LAG_VERSIONS_BATCH, 250e6 ); // Should be larger than STORAGE_DURABILITY_LAG_SOFT_MAX
|
||||
init( DURABILITY_LAG_UNLIMITED_THRESHOLD, 50e6 );
|
||||
init( INITIAL_DURABILITY_LAG_MULTIPLIER, 1.02 );
|
||||
init( DURABILITY_LAG_REDUCTION_RATE, 0.9999 );
|
||||
|
|
|
@ -150,7 +150,7 @@ FlowKnobs::FlowKnobs(bool randomize, bool isSimulated) {
|
|||
init( METRIC_LIMIT_RESPONSE_FACTOR, 10 ); // The additional queue size at which to disable logging of another level (higher == less restrictive)
|
||||
|
||||
//Load Balancing
|
||||
init( LOAD_BALANCE_ZONE_ID_LOCALITY_ENABLED, 1 );
|
||||
init( LOAD_BALANCE_ZONE_ID_LOCALITY_ENABLED, 0 );
|
||||
init( LOAD_BALANCE_DC_ID_LOCALITY_ENABLED, 1 );
|
||||
init( LOAD_BALANCE_MAX_BACKOFF, 5.0 );
|
||||
init( LOAD_BALANCE_START_BACKOFF, 0.01 );
|
||||
|
@ -172,6 +172,8 @@ FlowKnobs::FlowKnobs(bool randomize, bool isSimulated) {
|
|||
init( FUTURE_VERSION_INITIAL_BACKOFF, 1.0 );
|
||||
init( FUTURE_VERSION_MAX_BACKOFF, 8.0 );
|
||||
init( FUTURE_VERSION_BACKOFF_GROWTH, 2.0 );
|
||||
init( LOAD_BALANCE_MAX_BAD_OPTIONS, 1 ); //should be the same as MAX_MACHINES_FALLING_BEHIND
|
||||
init( LOAD_BALANCE_PENALTY_IS_BAD, true );
|
||||
}
|
||||
|
||||
static std::string toLower( std::string const& name ) {
|
||||
|
|
|
@ -194,6 +194,8 @@ public:
|
|||
double FUTURE_VERSION_INITIAL_BACKOFF;
|
||||
double FUTURE_VERSION_MAX_BACKOFF;
|
||||
double FUTURE_VERSION_BACKOFF_GROWTH;
|
||||
int LOAD_BALANCE_MAX_BAD_OPTIONS;
|
||||
bool LOAD_BALANCE_PENALTY_IS_BAD;
|
||||
|
||||
FlowKnobs(bool randomize = false, bool isSimulated = false);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue