-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ref(store): Random Kafka partitioning for sessions #1194
Conversation
@@ -673,8 +673,8 @@ impl KafkaMessage { | |||
Self::Attachment(message) => message.event_id.0, | |||
Self::AttachmentChunk(message) => message.event_id.0, | |||
Self::UserReport(message) => message.event_id.0, | |||
Self::Session(message) => message.session_id, | |||
Self::Metric(_message) => Uuid::nil(), // TODO(ja): Determine a partitioning key | |||
Self::Session(_message) => Uuid::nil(), // Explicit random partitioning for sessions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this NIL is overwritten immediately after the match block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, can we note down the observed scenario that motivated this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was hoping in code it's enough to say that we explicitly want uniform distribution. The full reasoning is in the PR description, and given that it's a hypothesis I wasn't gonna put this in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As long as we are sure that the partitioning by ID wasn't there for a reason, this looks good to me!
Asking for @fpacifici's blessing before merging this :) |
@@ -673,8 +673,8 @@ impl KafkaMessage { | |||
Self::Attachment(message) => message.event_id.0, | |||
Self::AttachmentChunk(message) => message.event_id.0, | |||
Self::UserReport(message) => message.event_id.0, | |||
Self::Session(message) => message.session_id, | |||
Self::Metric(_message) => Uuid::nil(), // TODO(ja): Determine a partitioning key | |||
Self::Session(_message) => Uuid::nil(), // Explicit random partitioning for sessions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, can we note down the observed scenario that motivated this change?
* master: ref(make): Simplify M1 exports in Makefile (#1206) fix(metrics): Wait for project states during aggregator shutdown (#1205) fix(test): Find librdkafka on Apple M1 (#1204) build: Bump sentry-relay in dev dependencies to 0.8.9 (#1202) ref(metrics): Tag backdated bucket creations in statsd (#1200) feat(metrics): Extract user satisfaction as tag (#1197) fix(statsd): Add new metric_type tag to existing metrics (#1199) fix: Apply clippy 1.59 suggestions (#1198)
Instead of using the session ID as partition key for producing sessions, assign
a random partitioning key. This ensures more even distribution of sessions on
the Kafka topic, even if clients are sending many updates for the same session.
We have noticed intermittent imbalance on the partitions. The theory is that
clients are sending repeat updates for the same session (ID) when a high number
of errors are occurring within that session. Every session update would go to
the same partition unless we use random partitioning.
Snuba does not have logical constraints on the partitioning.