Skip to content

perf(artifact-delivery): cut D1 round trips per run - #496

Merged
harlan-zw merged 1 commit into
mainfrom
perf/run-latency
Oct 6, 2026
Merged

harlan-zw merged 1 commit into
mainfrom
perf/run-latency

Conversation

@harlan-zw

Copy link
Copy Markdown
Collaborator

🔗 Linked issue

None. Launch prep for skilld run latency.

❓ Type of change

  • 📖 Documentation
  • 🐞 Bug fix
  • 👌 Enhancement
  • ✨ New feature
  • 🧹 Chore
  • ⚠️ Breaking change

📚 Description

The Artifact build queue consumer runs in a US colo, and the D1 primary is in Sydney. In production traces from 2026-10-07, each D1 round trip from the consumer took 158 to 244 ms, and one build made 19 to 22 of them. Every state change wrote the row, then read it back.

  • A state change returns its row with RETURNING *, so it costs one round trip.
  • A new Resolution request stores its row with INSERT ... RETURNING *. A replayed Idempotency-Key finds nothing inserted and reads the existing row.
  • A grant that names its Resolution, as the CLI always does, reads the row and its check results in one batch.
  • The test D1 shim returns rows for a batched write with RETURNING, as D1 does.

D1 round trips per path, counted by the new tests:

Path Before After
Fresh build 22 14
Reused build 19 11
New Resolution request 3 1
Replayed Resolution request 1 2
Grant that names its Resolution 2 1

🤖 AI disclosure: Harlan Agent Kit modified this description. My AI open-source policy.

The build queue consumer runs in a US colo, and the D1 primary is in
Sydney. Each round trip cost about 170 ms in production traces, and a
build spent 19 to 22 of them. Every state change wrote, then read the
row back. A state change now returns its row with RETURNING, a new
Resolution request stores its row in one statement, and a grant that
names its Resolution reads the row and its check results in one batch.
@harlan-zw harlan-zw added the harlan-agent-review Pull request triage requires an adversarial Review. Adding this label manually always forces one. label Oct 6, 2026
@harlan-github-agent harlan-github-agent Bot added harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. and removed harlan-agent-review Pull request triage requires an adversarial Review. Adding this label manually always forces one. labels Oct 6, 2026
@harlan-github-agent

harlan-github-agent Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

🤖 MERGED

Harlan Agent Kit posted this automated review. It is not Harlan's personal review or approval. AI open source policy. Last updated: 2026-10-06 16:50 UTC.

GitHub merged this pull request.

No material findings were recorded.

0ee3121a-c99e-4016-acd0-cebe83e086bd

@harlan-github-agent harlan-github-agent Bot added harlan-agent-ready The automated Review passed every gate on this head commit. and removed harlan-agent-review-required Pull request triage requires an adversarial Review for this head commit. labels Oct 6, 2026

@harlan-github-agent harlan-github-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Harlan Agent Kit posted this automated review. AI open source policy.

Automated Review: READY.

Read the Review results

@harlan-zw
harlan-zw merged commit 1c989fd into main Oct 6, 2026
7 checks passed
@harlan-github-agent harlan-github-agent Bot removed the harlan-agent-ready The automated Review passed every gate on this head commit. label Oct 6, 2026
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