Reuse batch-sync connections and promptly retry peer progress - #150
Open
philsippl wants to merge 1 commit into
Open
Reuse batch-sync connections and promptly retry peer progress#150philsippl wants to merge 1 commit into
philsippl wants to merge 1 commit into
Conversation
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.
Batch synchronization currently constructs a new HTTP client for every poll and waits a full second when a peer is briefly on the preceding batch. On the three-party CPU scan benchmark, this caused clusters of one-second stalls even though each matching pass took about 140 ms.
Reuse a shared HTTP client and its connection pool. For batch-ID conflicts, older IDs, and differing hashes, retry after 5 ms and double the delay up to 100 ms. Transport failures, unexpected HTTP errors, and malformed responses retain their one-second retry. Existing batch/hash checks and outer timeouts are preserved.
Validation: all 13
ampc-server-utilslibrary tests pass; clippy with-D warningspasses. The new local HTTP regression test covers HTTP 409, a stale successful batch response, and a stale hash; it verifies eventual exact states/entries and connection reuse. In worldcoin/iris-mpc#2386, three r8g.24xlarge hosts running 128-request bursts against approximately 1.05 million records measured the following with 64 score cores and 32 runtime cores:The old-synchronization run contained clusters of approximately one-second stalls; these did not occur in the new runs' measured intervals. Median batch reception fell from 23 ms to 1 ms. Matching throughput is unchanged within measurement noise, as expected. Initial queue wait still varies: whole-burst rates from first publish were 12.31M and 10.76M comp/s for the new runs. These are finite synthetic service bursts with Moto, PostgreSQL, TLS, MPC, persistence, and all-party result delivery, not sustained production capacity measurements. Each run validated 384 agreeing responses. The integration PR pins this exact commit.