MCPcopy
hub / github.com/segmentio/kafka-go / RackAffinityGroupBalancer

Struct RackAffinityGroupBalancer

groupbalancer.go:153–158  ·  view source on GitHub ↗

RackAffinityGroupBalancer makes a best effort to pair up consumers with partitions whose leader is in the same rack. This strategy can have performance benefits by minimizing round trip latency between the consumer and the broker. In environments where network traffic across racks incurs charges (

Source from the content-addressed store, hash-verified

151// This balancer requires Kafka version 0.10.0.0+ or later. Earlier versions do
152// not return the brokers' racks in the metadata request.
153type RackAffinityGroupBalancer struct {
154 // Rack is the name of the rack where this consumer is running. It will be
155 // communicated to the consumer group leader via the UserData so that
156 // assignments can be made with affinity to the partition leader.
157 Rack string
158}
159
160func (r RackAffinityGroupBalancer) ProtocolName() string {
161 return "rack-affinity"

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected