Skip to content

Sharding - #1241

Open
CatherineF-dev wants to merge 4 commits into
GoogleCloudPlatform:masterfrom
CatherineF-dev:sharding
Open

Sharding#1241
CatherineF-dev wants to merge 4 commits into
GoogleCloudPlatform:masterfrom
CatherineF-dev:sharding

Conversation

@CatherineF-dev

Copy link
Copy Markdown
Contributor

No description provided.

The pod labels informer cached the full OwnerReferences of every pod,
but getLabelsFromMeta only reads Kind and Name, and only for
DaemonSet/StatefulSet/ReplicaSet/Job owners. Cache just those two
fields for those kinds, drop owner references of other kinds, and nil
out empty label maps. This shrinks the per-pod footprint of the
cluster-wide pod metadata cache on large clusters.
Add --total-shards and --shard-id flags. When total-shards > 1, each
replica exports only the events whose involved object UID hashes
(FNV-1a) to its shard, so every event is exported by exactly one
replica. shard-id defaults to -1, which derives the ID from the pod
hostname ordinal suffix, matching StatefulSet replica names.

The filter wraps the sink handler in createWatcher, so both the
streaming path (handler called directly from streamingListEvents) and
the reflector store path are covered. Filtered events are counted in
the new sharding_filtered_events_count metric.

Sharding by involved object UID rather than by namespace avoids
namespace-size skew, and for pod events the involved object UID is the
pod UID, which allows the pod label cache to be sharded by the same
key in a follow-up.
When sharding is enabled, the pod labels informer transform drops pods
whose UID belongs to another shard, using the same hash as the event
filter. Since events are sharded by involved object UID and for pod
events that is the pod UID, the shard that exports a pod's events
always has that pod in its cache; owner label lookups keep working
with no cross-shard misses.

This divides the dominant steady-state memory consumer, the
cluster-wide pod metadata cache, by the number of shards on each
replica.
--sink=local writes each exported event as a JSON line to stdout
(prefixed with EXPORTED_EVENT), including the pod owner labels looked
up the same way the Stackdriver sink does. This allows running the
exporter in clusters without Stackdriver access (e.g. kind) and
verifying export behavior, such as exactly-once delivery under
sharding, from pod logs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant