Merge pull request #1820 from fzhjon/load-balance-locality

Introduced a knob that can turn locality on/off
This commit is contained in:
Evan Tschannen 2019-07-16 16:40:43 -07:00 committed by GitHub
commit 5d3e69b6fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -198,13 +198,14 @@ ProcessClass::Fitness ProcessClass::machineClassFitness( ClusterRole role ) cons
}
LBDistance::Type loadBalanceDistance( LocalityData const& loc1, LocalityData const& loc2, NetworkAddress const& addr2 ) {
if ( loc1.zoneId().present() && loc1.zoneId() == loc2.zoneId() )
if ( FLOW_KNOBS->LOAD_BALANCE_ZONE_ID_LOCALITY_ENABLED && loc1.zoneId().present() && loc1.zoneId() == loc2.zoneId() ) {
return LBDistance::SAME_MACHINE;
}
//FIXME: add this back in when load balancing works with local requests
//if ( g_network->isAddressOnThisHost( addr2 ) )
// return LBDistance::SAME_MACHINE;
if ( loc1.dcId().present() && loc1.dcId() == loc2.dcId() )
if ( FLOW_KNOBS->LOAD_BALANCE_DC_ID_LOCALITY_ENABLED && loc1.dcId().present() && loc1.dcId() == loc2.dcId() ) {
return LBDistance::SAME_DC;
}
return LBDistance::DISTANT;
}

View File

@ -149,6 +149,8 @@ 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_DC_ID_LOCALITY_ENABLED, 1 );
init( LOAD_BALANCE_MAX_BACKOFF, 5.0 );
init( LOAD_BALANCE_START_BACKOFF, 0.01 );
init( LOAD_BALANCE_BACKOFF_RATE, 2.0 );

View File

@ -169,6 +169,8 @@ public:
int MAX_METRICS;
//Load Balancing
int LOAD_BALANCE_ZONE_ID_LOCALITY_ENABLED;
int LOAD_BALANCE_DC_ID_LOCALITY_ENABLED;
double LOAD_BALANCE_MAX_BACKOFF;
double LOAD_BALANCE_START_BACKOFF;
double LOAD_BALANCE_BACKOFF_RATE;