mirror of
https://github.com/apple/foundationdb.git
synced 2025-06-01 18:56:00 +08:00
Merge pull request #1820 from fzhjon/load-balance-locality
Introduced a knob that can turn locality on/off
This commit is contained in:
commit
5d3e69b6fc
@ -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;
|
||||
}
|
||||
|
@ -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 );
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user