Repository navigation
the warm arm was warm for exactly one provider. Prime the connection. - #2905
Merged
Merged
Conversation
#2896 added warm and cold arms to stop the ranking depending on accidental connection reuse. It made that dependency worse. Alternating the two arms doubled each one's effective interval, from 60 s to 120 s, and most endpoints drop an idle connection inside that window. The connection trace on eu says it plainly: shared.eu-central-1.getblock.io reused=TRUE tls= 0ms wispy-white-bush.ethereum-mainnet.quiknode.pro reused=false tls=10ms neat-dawn-shape.bsc.quiknode.pro reused=false tls=10ms ethereum-mainnet.core.chainstack.com reused=false tls= 9ms polygon-mainnet.g.alchemy.com reused=false tls=10ms GetBlock serves all nine chains from one hostname, so the other chains' traffic keeps its socket hot every ~13 s. Everyone else uses a hostname per chain, touched once per 120 s, and pays a handshake every time. The "warm" column was therefore warm for one provider and cold for the other three, which is the original bug amplified rather than removed. Every keyed number published since #2896 is wrong, including the p50 table I read off it. ## The fix primeWarm sends one unmeasured request through warmTransport before the measured one, so the measurement is guaranteed to ride a pooled socket instead of hoping one survived. The response is drained before closing: a body left unread never returns to the pool, which would defeat the whole call. The quota guard now reserves two requests on a warm tick instead of one, so it counts what we actually send. That is +50% volume against budgets running 600k-2M per region per month on ~195k used. Determinism is the point. A warm figure that depends on whether a socket happened to survive is not a measurement, and it systematically favours whoever reuses one hostname across many chains. ## Verification PROBE_TRACE_CONN=1 is already set on rpc-keyed-eu. The check is that every hostname logs reused=true on warm ticks, not just GetBlock's. go build and go vet clean.
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 warm arm was warm for exactly one provider. Prime the connection.
#2896 added warm and cold arms to stop the ranking depending on accidental
connection reuse. It made that dependency worse.
Alternating the two arms doubled each one's effective interval, from 60 s to
120 s, and most endpoints drop an idle connection inside that window. The
connection trace on eu says it plainly:
shared.eu-central-1.getblock.io reused=TRUE tls= 0ms
wispy-white-bush.ethereum-mainnet.quiknode.pro reused=false tls=10ms
neat-dawn-shape.bsc.quiknode.pro reused=false tls=10ms
ethereum-mainnet.core.chainstack.com reused=false tls= 9ms
polygon-mainnet.g.alchemy.com reused=false tls=10ms
GetBlock serves all nine chains from one hostname, so the other chains' traffic
keeps its socket hot every ~13 s. Everyone else uses a hostname per chain,
touched once per 120 s, and pays a handshake every time. The "warm" column was
therefore warm for one provider and cold for the other three, which is the
original bug amplified rather than removed. Every keyed number published since
#2896 is wrong, including the p50 table I read off it.
The fix
primeWarm sends one unmeasured request through warmTransport before the
measured one, so the measurement is guaranteed to ride a pooled socket instead
of hoping one survived. The response is drained before closing: a body left
unread never returns to the pool, which would defeat the whole call.
The quota guard now reserves two requests on a warm tick instead of one, so it
counts what we actually send. That is +50% volume against budgets running
600k-2M per region per month on ~195k used.
Determinism is the point. A warm figure that depends on whether a socket
happened to survive is not a measurement, and it systematically favours whoever
reuses one hostname across many chains.
Verification
PROBE_TRACE_CONN=1 is already set on rpc-keyed-eu. The check is that every
hostname logs reused=true on warm ticks, not just GetBlock's.
go build and go vet clean.