Skip to content

Reuse HTTP connection and add chunked single-request batch resolve - #47

Merged
antirotor merged 3 commits into
ynput:developfrom
timkeller:prep/perf-wan
Jun 29, 2026
Merged

Reuse HTTP connection and add chunked single-request batch resolve#47
antirotor merged 3 commits into
ynput:developfrom
timkeller:prep/perf-wan

Conversation

@timkeller

Copy link
Copy Markdown
Contributor

Changelog Description

Over a WAN link the handshake dominates per-call latency. This PR enables:

1/
keep-alive on the AyonApi httplib client so the TCP/TLS connection is reused across resolves instead of a fresh handshake per request.

2/
batchResolvePathSerial(): which resolves a whole frontier of uris in one POST over that persistent client, split into capped chunks (m_maxSerialBatchSize) so a large frontier never sends an unbounded request or holds a server DB connection for the full set.

Additional review information

Keep-alive can be disabled with AYON_RESOLVER_NO_KEEPALIVE=1 for benchmarking.

Testing notes:

Tested from Cape Town, South Africa to Ynput Cloud. On a heavy shot this PR cut serial stage-open resolution from about 33s to 14s on its own, roughly 2.4x, before any other batching or caching.

Enable keep-alive on the AyonApi httplib client so the TCP/TLS connection is
reused across resolves instead of a fresh handshake per request; over a WAN
link the handshake dominates per-call latency. Keep-alive can be disabled with
AYON_RESOLVER_NO_KEEPALIVE=1 for benchmarking.

Add batchResolvePathSerial(): resolve a whole frontier of uris in one POST over
that persistent client, split into capped chunks (m_maxSerialBatchSize) so a
large frontier never sends an unbounded request or holds a server DB connection
for the full set.

@antirotor antirotor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense to me, but lets have @tadeas-hejnic final word :)

timkeller and others added 2 commits June 8, 2026 17:10
The AYON server rejects /api/resolve with HTTP 400 when the X-ayon-site-id
header is present but empty or names an unregistered site. That breaks
resolution on service-account and cloud workstations with no registered site.
Add the header only when m_siteId is non-empty.
@antirotor
antirotor merged commit 324e05a into ynput:develop Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants