Skip to content

the warm arm was warm for exactly one provider. Prime the connection. - #2905

Merged
Flotapponnier merged 1 commit into
mainfrom
fix/prime-warm-connection
Oct 8, 2026
Merged

Flotapponnier merged 1 commit into
mainfrom
fix/prime-warm-connection

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

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.

#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.
@Flotapponnier
Flotapponnier merged commit 5bb5847 into main Oct 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant