Repository navigation
perf: stop idle workers spinning on busy peers' pinned queues - #1260
Merged
Merged
Conversation
This was referenced Oct 30, 2026
Merged
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.
The 2026-10-30 suite run read the HTTP server at 876k req/s at 32 connections and 1.45M at 256, against 1.22M and 1.83M in the published table. The Go and Rust servers reproduced their figures. A bisect over the 65 commits since the published run stopped at #1233.
In #1233,
steal_pinnedspun for up to 20us on every busy peer with a non-empty pinned fifo each time a worker ran out of work. A loaded server always has such peers, so its idle workers spent their time spinning. Withsteal_pinnedturned off, the server read 1.22M and 1.98M again.A worker now keeps a record of each peer's resume count and when it read it. It takes a task on a later pass if the peer is still running and the count has not moved for 20us. While it is watching a peer, it parks for 20us instead of backing off, so a stuck peer is still relieved quickly. The record is a local of the worker loop rather than a thread-local, because the TLS barrier check forbids a thread-local address in a frame that resumes tasks.
Measurements on a 9950X, server and benchmarks on cores 0-7,16-23:
lock_sweep/spawnandlock_sweep/breakerare bimodal on both builds, at about 36/48 ms and 87/113 ms. Over 15 interleaved rounds each, their medians match main.Tests: runtime unit tests (the steal test now checks that the first look only records), TLS barrier check, green-thread tests, and the self-hosted regression corpus. The full gate suite also passed on the first version of this change.