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

fix(hybridcloud) Deliver payloads concurrently #66870

Merged
merged 2 commits into from Mar 15, 2024
Merged

Conversation

markstory
Copy link
Member

We're hitting the ceiling of how many messages we can deliver concurrently with single threaded workers. Because most of our time is spent in IO, we can get more throughput by sacrificing strong ordering and delivering messages in small concurrent batches.

Should a batch contain a delivery that needs to be retried progress will be stopped. This means we could delivery n-1 messages out of order if we hit an intermittent error.

Initially I only want to use parallel delivery for large mailboxes as they would naturally not have strong ordering due to the amount of concurrency they create. Both the usage of threaded io and the threadpool size can be controlled by options.

We're hitting the ceiling of how many messages we can deliver
concurrently with single threaded workers. Because most of our time is
spent in IO, we can get more throughput by sacrificing strong ordering
and delivering messages in small concurrent batches.

Should a batch contain a delivery that needs to be retried progress will
be stopped. This means we could delivery n-1 messages out of order if we
hit an intermittent error.

Initially I only want to use parallel deliery for large mailboxes as
they would naturally not have strong ordering due to the amount of
concurrency they create. Both the usage of threaded io and the
threadpool size can be controlled by options.
@markstory markstory requested a review from a team as a code owner March 13, 2024 15:31
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 13, 2024
Comment on lines +241 to +242
if payload_record.attempts >= MAX_ATTEMPTS:
payload_record.delete()
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a behavior difference from the single-threaded delivery. I was trying to avoid iterating records multiple times and having more complex logic. The downside is sending an 11th request.

Copy link

codecov bot commented Mar 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.27%. Comparing base (9e031ee) to head (061c623).
Report is 22 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #66870   +/-   ##
=======================================
  Coverage   84.27%   84.27%           
=======================================
  Files        5308     5306    -2     
  Lines      237401   237334   -67     
  Branches    41066    41056   -10     
=======================================
- Hits       200071   200025   -46     
+ Misses      37112    37091   -21     
  Partials      218      218           
Files Coverage Δ
src/sentry/hybridcloud/tasks/deliver_webhooks.py 95.90% <100.00%> (+1.64%) ⬆️
src/sentry/options/defaults.py 100.00% <100.00%> (ø)

... and 25 files with indirect coverage changes

Copy link
Member

@dashed dashed left a comment

Choose a reason for hiding this comment

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

Looks parallel to me

@markstory markstory merged commit b558535 into master Mar 15, 2024
49 checks passed
@markstory markstory deleted the feat-parallel-delivery branch March 15, 2024 15:31
JonasBa pushed a commit that referenced this pull request Mar 17, 2024
We're hitting the ceiling of how many messages we can deliver
concurrently with single threaded workers. Because most of our time is
spent in IO, we can get more throughput by sacrificing strong ordering
and delivering messages in small concurrent batches.

Should a batch contain a delivery that needs to be retried progress will
be stopped. This means we could delivery n-1 messages out of order if we
hit an intermittent error.

Initially I only want to use parallel delivery for large mailboxes as
they would naturally not have strong ordering due to the amount of
concurrency they create. Both the usage of threaded io and the
threadpool size can be controlled by options.
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants