Skip to content
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(span-buffer): Reduce zadd/zrem calls to Redis #88463

Merged
merged 2 commits into from
Apr 2, 2025

Conversation

untitaker
Copy link
Member

Build up a bunch of temporary datastructures in Python to relieve load
on Redis. The result is more CPU usage in consumers but that might be
worth it.

Build up a bunch of temporary datastructures in Python to relieve load
on Redis. The result is more CPU usage in consumers but that might be
worth it.
@untitaker untitaker requested a review from a team as a code owner April 1, 2025 17:46
@untitaker untitaker requested a review from jan-auer April 1, 2025 17:46
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 1, 2025
Copy link
Member

@jan-auer jan-auer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you! Good to merge once this has passed benchmarks.

p.expire(key, self.redis_ttl)
has_root_span_count = 0
min_hole_size = float("inf")
max_hole_size = float("-inf")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note I'm renaming these in #88453, so we will need to resolve a conflict there.


assert len(queue_keys) == len(results)

for queue_key, (hole_size, delete_item, add_item, has_root_span) in zip(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can we type the redis script result and then pass the queue part through a sub-function for readability?

Hole size can be iterated and logged entirely separately from the remaining result.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

discussed offline, let's keep as-is due to unrelated metrics being recorded in this loop

@untitaker untitaker merged commit 8cd5726 into master Apr 2, 2025
48 checks passed
@untitaker untitaker deleted the ref/spans-faster-queue branch April 2, 2025 14:35
andrewshie-sentry pushed a commit that referenced this pull request Apr 8, 2025
Build up a bunch of temporary datastructures in Python to relieve load
on Redis. The result is more CPU usage in consumers but that might be
worth it.
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants