~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/knotless

git that lives in your Atmosphere account

knotless.dev
1 collaborator

knotless 0.13.0 Latest 2 packages, 1 image

1
10

The bench reaches the PDS over https, and counts connecting

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/knotless:bench/as-the-network

The performance page's times left out what a command spends connecting to a PDS, and what a push asks an appview. The bench now reaches the PDS as one on the network is reached, over https, and the page is measured again: a push at 50 ms is 296 ms, where the page said 205, and 507 ms from a client with an appview, as every installed one has. That last number is the one to read this for.

Claude Fable 5.2

What changes

The bench (crates/knotless/examples/bench.rs) puts harness/tls-proxy.mjs in front of the PDS, with a certificate it makes for 127.0.0.1, and its delay proxy holds what a client sends first one round trip more, as TCP's handshake would. --plain is the bench as it was: plain http, connecting free, which leaves the requests' round trips alone. It takes --rounds (4) rounds, each on a repository of its own, and counts their samples together, so a p95 is of 60 samples and not 15, and prints the slowest. Three things are new in what it measures: a push of a branch by a client with an appview (knotless-serve started with an index, behind the same proxy), agents pushing a branch each at 1, 4, 16 and 64 at once with pushes a second, and the cache's mirror warmed before the commits are timed, as the push was already.

tests/common gains tls_front, an https front with a certificate and host given; tls_proxy is that with the harness's.

docs/reference/performance.md is measured again with it. Round trips gains two rows, connecting and the appview's two requests. Benchmarks is the https run at 50 ms, and says what is still kinder than a real PDS. Two sections are new: Many branches at once, and Other round-trip times, the bench at 0, 100 and 200 ms with each operation's round trips as the slope, and how many of them are requests.

Why

The page's push was 205 ms at 50 ms of round-trip time: two requests and what the machine does. Every command is a process of its own, so over https each also pays TCP's handshake and TLS's, two round trips, before its first request. And a client with KNOTLESS_APPVIEW set, which is the default, asks the appview two things after a push of a branch, one after the other on a connection of its own, before git hears the push landed: four round trips more. Measured so, a push is 4.0 round trips and with an appview 8.0.

Measuring at more than one latency is also what found repo commit reading the repository twice, fixed in repo commit reads the repository once, a round trip less: its slope was 3 where the page said 2. The page's numbers here are with that fix.

How it was checked

Run here, on an M1 Pro, release build: over https at 0, 50, 100 and 200 ms with four rounds each, and --plain at 0 and 200 ms with two. The slopes from 0 to 200 ms came out whole numbers but one: push 4.03, fetch 3.02, push with an appview 8.01, repo commit 4.05, both clones 3.0; of them requests, from --plain, 2.02, 1.01, 4.03, 2.03, 1.0. cargo clippy -p knotless --example bench -- -D warnings and node harness/docs.mjs pass here. check, test and docs are left to CI: every test binary includes tests/common.

Shortcomings

  • Each latency was run once, on a machine with other builds going (load averages from 7 to 18), so what an operation costs before the network may read high.
  • TCP's handshake is charged, not made: the proxy holds a connection's first bytes. TLS is real, but its front speaks HTTP/1.1, where a PDS's may speak HTTP/2.
  • The bench's appview has an empty index and follows no feed, so its two answers cost what empty ones do.
  • A push that costs twice as much with an appview is measured here and not fixed. The two requests could go out together, or after git is answered, as compaction does.
  • README.md still has a table older than the one this replaces.
Approved

This puts the bench behind an https front, adds a TCP handshake round trip in the delay proxy, and measures the appview push and the 1/4/16/64 agent swarms. tests/common gains tls_front, and performance.md is remeasured.

I found no bugs. These are the things I checked:

  • The delayed first bytes in pipe keep chunk order, because max(open) + delay never goes backwards.
  • KNOTLESS_CA_CERTS and --index both exist in the code.
  • knotless-serve is spawned after KNOTLESS_SERVICE is set, so it reaches the PDS through the same https proxy.
  • The swarm branch names don't collide when the agent clones are reused across swarm sizes.

The changes are in an example, test helpers and docs, so no change file is needed. I didn't run the bench, so the numbers in the doc are the author's own measurements, and they say so under Shortcomings. I left README.md's older table alone, as the body says.

Merged as 1bcffd3