Repository navigation
fix(subscriptions): share the activation slots between tenants - #3418
Open
angela-helios wants to merge 1 commit into
Open
angela-helios wants to merge 1 commit into
angela-helios wants to merge 1 commit into
Conversation
Pending activations were picked in HashMap order from one global set, so a tenant with many Subscriptions on endpoints that never answer the handshake could hold every activation slot. Pending activations now take turns by tenant, in arrival order within a tenant, and one tenant runs at most half of handshake_concurrency (rounded up). DispatchSnapshot reports the share. Closes #3111
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3111
Behaviour change to review
One tenant now runs at most half of
HFS_SUBSCRIPTION_HANDSHAKE_CONCURRENCYactivation flows at once, rounded up: 4 of the default 8. This also applies to a single-tenant deployment; an operator who wants the previous rate for one tenant doubles the setting. No new setting is added, and nothing is rejected: activations past the share wait.Summary
The activation slots were shared by every tenant, and the next pending activation was picked in
HashMaporder. A tenant with manyrequestedSubscriptions on endpoints that never answer could hold every slot and delay other tenants' activation without a bound.DispatchSnapshotreports the share ashandshake_concurrency_per_tenant.Not covered: the per-tenant share of channel attempt slots, a cap on pending activations, and the separate startup rehydration limit (
HFS_SUBSCRIPTION_REHYDRATE_HANDSHAKE_CONCURRENCY), which still admits stored Subscriptions in tenant order.Tests
New unit tests in
engine/dispatch.rs:pending_activations_take_turns_by_tenant_in_arrival_ordera_tenant_at_its_activation_share_is_skipped_and_keeps_its_turna_removed_pending_activation_leaves_the_orderone_tenant_cannot_hold_every_activation_slot: one tenant's endpoints never answer, and another tenant's Subscription still becomesactivea_deleted_subscription_returns_its_activation_shareResults:
cargo test -p helios-subscriptions --lib: 258 passed.--test dispatch_backpressure: 20 passed.--test rehydrate_integration: 15 passed.--test status_persistence: 8 passed.cargo test -p helios-rest --libwith thesubscriptionsfeature: 1149 passed.These ran together with the fix for #2723. Both edit
crates/subscriptions/README.mdand conflict there (text only), so the later one to merge needs its branch updated.