pub struct ShuffleSharding {
pub percent: u32,
pub min_backends: u32,
pub mode: ShardMode,
}Expand description
A cluster’s shuffle-sharding policy (sozu-proxy/sozu#524).
Shuffle sharding (Colm MacCárthaigh, Workload isolation using shuffle
sharding, Amazon Builders’ Library, 2019) gives each client a shard: a
small subset of the cluster’s backends, drawn so that two clients rarely
share all of theirs. A client that overloads or poisons its shard then
takes down only the clients whose shard is entirely inside its own. With
N backends in shards of k there are C(N, k) shards, against N / k
with plain partitioning: C(8, 2) = 28 against 4.
Here a client’s shard is the top k of the rendezvous (HRW) ranking of
its affinity key over the cluster’s primary backends (hrw_score;
David Thaler and Chinya Ravishankar, Using name-based mappings to
increase hit rates, IEEE/ACM Transactions on Networking, 1998). That
makes a shard stable: removing a backend outside a client’s shard leaves
the shard unchanged, and adding one can only displace the shard’s
lowest-ranked member, so a change of N moves clients only at the tail of
their ranking. The cluster’s load-balancing policy then selects inside the
shard.
Fields§
§percent: u32Share of the primary backends in a shard, 1..=100.
min_backends: u32Sharding applies only from this many primary backends.
mode: ShardModeWhat an exhausted shard does.
Implementations§
Source§impl ShuffleSharding
impl ShuffleSharding
Sourcepub fn from_cluster(
shard_percent: Option<u32>,
shard_min_backends: Option<u32>,
shard_mode: Option<i32>,
) -> Option<Self>
pub fn from_cluster( shard_percent: Option<u32>, shard_min_backends: Option<u32>, shard_mode: Option<i32>, ) -> Option<Self>
The sharding a cluster configures, None when shard_percent is
unset. shard_min_backends defaults to
DEFAULT_SHARD_MIN_BACKENDS, shard_mode to FALLBACK.
Sourcepub fn shard_size(&self, primaries: usize) -> Option<usize>
pub fn shard_size(&self, primaries: usize) -> Option<usize>
The shard size k for a cluster of primaries primary backends:
max(2, ceil(percent × primaries / 100)), capped at primaries.
None below min_backends, where the cluster is not sharded.
Trait Implementations§
Source§impl Clone for ShuffleSharding
impl Clone for ShuffleSharding
impl Copy for ShuffleSharding
Source§impl Debug for ShuffleSharding
impl Debug for ShuffleSharding
impl Eq for ShuffleSharding
Source§impl PartialEq for ShuffleSharding
impl PartialEq for ShuffleSharding
impl StructuralPartialEq for ShuffleSharding
Auto Trait Implementations§
impl Freeze for ShuffleSharding
impl RefUnwindSafe for ShuffleSharding
impl Send for ShuffleSharding
impl Sync for ShuffleSharding
impl Unpin for ShuffleSharding
impl UnsafeUnpin for ShuffleSharding
impl UnwindSafe for ShuffleSharding
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.