Skip to content

ref(spans): Pin redis sharding to partition index #93209

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

Merged
merged 4 commits into from
Jun 10, 2025

Conversation

jan-auer
Copy link
Member

@jan-auer jan-auer commented Jun 10, 2025

We observe performance degradation of the process-spans consumer with an
increasing number of Redis shards. By using the partition index instead of the
trace ID as sharding key, we pin each partition to exactly one Redis shard,
which should reduce this effect.

The downside is that a single hot partition can no longer be spread across
multiple Redis shards. At the current time, we operate 4-8 partitions per shard,
so we do not expect that this becomes an issue in the short time.

If this proves successful, we should follow up with proper cellularization of
the buffer consumer.

Ref VIEPF-45

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 10, 2025
Copy link

sentry-io bot commented Jun 10, 2025

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: src/sentry/spans/consumers/process/factory.py

Function Unhandled Issue
process_batch KafkaException: KafkaError{code=_DESTROY,val=-197,str="Commit failed: Local: Broker handle destroyed"} ...
Event Count: 20.7k

Did you find this useful? React with a 👍 or 👎

Copy link

codecov bot commented Jun 10, 2025

Codecov Report

Attention: Patch coverage is 96.29630% with 1 line in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/sentry/spans/consumers/process/factory.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #93209      +/-   ##
==========================================
+ Coverage   85.31%   87.97%   +2.65%     
==========================================
  Files       10256    10256              
  Lines      591639   591759     +120     
  Branches    22989    22986       -3     
==========================================
+ Hits       504768   520593   +15825     
+ Misses      86380    70675   -15705     
  Partials      491      491              

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 10, 2025
Copy link
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@jan-auer jan-auer force-pushed the ref/spans-buffer-pin-redis branch from 655f4cb to 33a752a Compare June 10, 2025 11:08
@jan-auer jan-auer marked this pull request as ready for review June 10, 2025 11:08
@jan-auer jan-auer requested review from a team as code owners June 10, 2025 11:08
@jan-auer jan-auer enabled auto-merge (squash) June 10, 2025 11:13
@jan-auer jan-auer merged commit 7cee132 into master Jun 10, 2025
60 checks passed
@jan-auer jan-auer deleted the ref/spans-buffer-pin-redis branch June 10, 2025 11:30
@jan-auer jan-auer added the Trigger: Revert Add to a merged PR to revert it (skips CI) label Jun 10, 2025
@jan-auer jan-auer restored the ref/spans-buffer-pin-redis branch June 10, 2025 12:50
@getsentry-bot
Copy link
Contributor

PR reverted: 4a34dac

getsentry-bot added a commit that referenced this pull request Jun 10, 2025
jan-auer added a commit that referenced this pull request Jun 10, 2025
* master:
  Revert "ref(spans): Pin redis sharding to partition index (#93209)"
  chore: add DemoModeGuardMiddleware logging (#92926)
  feat(tempest): Dynamically fetch ip addresses (#93012)
  fix(demo-mode): cleanup demo-mode sync options (#92918)
  ref(sdk): Migrate to `sentry_sdk.get_global_scope` (#93020)
  ref(sdk): Migrate to `get_isolation_scope` (#93019)
  ref(spans): Pin redis sharding to partition index (#93209)
andrewshie-sentry pushed a commit that referenced this pull request Jun 19, 2025
We observe performance degradation of the `process-spans` consumer with
an increasing number of Redis shards. By using the partition index
instead of the trace ID as sharding key, we pin each partition to
exactly one Redis shard, which should reduce this effect.

The downside is that a single hot partition can no longer be spread
across multiple Redis shards. At the current time, we operate 4-8
partitions per shard, so we do not expect that this becomes an issue in
the short time.
andrewshie-sentry pushed a commit that referenced this pull request Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components Trigger: Revert Add to a merged PR to revert it (skips CI)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants