Repository navigation
perf(gateway): release idle World Sessions from blocking workers - #713
Merged
Merged
Conversation
This was referenced Oct 16, 2026
Mathih13
force-pushed
the
perf/gateway-read-indexes
branch
from
October 16, 2026 06:21
4b93fe1 to
4149e71
Compare
Mathih13
force-pushed
the
perf/async-world-sessions
branch
from
October 16, 2026 06:21
5a006cc to
76dd8df
Compare
Contributor
Author
|
Merged after adversarial review and repairs. World Session tests now exercise the production async transport. The repairs keep earlier packets ahead of later Relay jobs, close sockets during accepted work, and retain admission seats and connection permits until cleanup finishes. The new cancellation regressions failed before the repair and passed after it. Review repairs. All nine checks passed at Comment review passed. No real-client or capacity measurement is claimed. |
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.
Each World Session keeps reader and writer threads while idle. Connection count therefore consumes blocking workers, and queued outbound jobs have no fixed limit.
Use asynchronous World socket I/O and login-queue waits. Run synchronous Store calls and Relay encoding through bounded worker pools. Add a separate accepted-connection limit, outbound count and byte reservations, queue-age limits, and batched writes. A supervisor owns cleanup until accepted game work completes. One writer owns the header cipher and preserves packet order.
Part 4 of 6. Follows #712. Merged in stack order. Next: #714.
Verification
World Session and wire tests now use the production async transport. They caught truncated-body handling, entry packets lost before a later Relay closed the socket, and delayed socket closure during accepted work. The repairs preserve FIFO writes and retain admission seats and connection permits through cleanup. The cancellation regressions failed before the repair and passed after it.
Two independent adversarial review rounds are complete. No actionable finding remains. The reviewed stack passed offline binding generation, formatting, workspace Clippy with all targets and features, and the Gateway unit and integration test targets. The Gateway binary passed 2,148 tests. Local builds used one job; no local SpacetimeDB instance or load test ran.
All nine checks passed at
76dd8df3: Module durable tests and Gateway bindings, Runtime Scripts, Rust.Comment review passed for the final changed source, tests, scripts and configuration. Retained protocol and ordering contracts match the code.
Verification limits
No real build-5875 client, capacity run, or slow-client load test was run. Store calls remain synchronous behind bounded workers. No capacity gain is claimed.
Risk
This replaces the production World transport. Queue overflow or an expired outbound entry closes the World Session. Typed messages and deferred jobs use byte reservations, which are not an exact heap bound on captured Rust objects.
LYRACORE_MAX_WORLD_CONNECTIONSdefaults to 16,384 accepted sockets; this is a limit, not a measured capacity.Models: GPT-6 Astra. Harness: Codex in T3 Code.