MCPcopy Create free account
hub / github.com/cortexproject/cortex / ShuffleShardExpectedInstancesPerZone

Function ShuffleShardExpectedInstancesPerZone

pkg/util/shard.go:41–43  ·  view source on GitHub ↗

ShuffleShardExpectedInstancesPerZone returns the number of instances that should be selected for each zone when zone-aware replication is enabled. The algorithm expects the shard size to be divisible by the number of zones, in order to have nodes balanced across zones. If it's not, we do round up.

(shardSize, numZones int)

Source from the content-addressed store, hash-verified

39// zone when zone-aware replication is enabled. The algorithm expects the shard size to be divisible
40// by the number of zones, in order to have nodes balanced across zones. If it's not, we do round up.
41func ShuffleShardExpectedInstancesPerZone(shardSize, numZones int) int {
42 return int(math.Ceil(float64(shardSize) / float64(numZones)))
43}
44
45// ShuffleShardExpectedInstances returns the total number of instances that should be selected for a given
46// tenant. If zone-aware replication is disabled, the input numZones should be 1.

Calls

no outgoing calls

Tested by 1