Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

A free and open-source forge that lives in your Git repo.

Metadata writers queue on the branch instead of racing for it

122cbe4f62bf87a941538450584ba1b20444c135 · Keenan Nemetz · 7d ago · parent 4739664b

Metadata writers queue on the branch instead of racing for it

Every write to refs/heads/vole read the whole branch, decided, and moved the
ref with a compare-and-swap, retrying up to 64 times with no backoff and no
coordination. Concurrent writers therefore did not queue: they each paid a full
read, lost, and paid it again. Measured on a 2,000-file branch, one write needed
one attempt alone and 21 with 32 writers, and throughput fell as writers were
added because the retries were the load. At 64 simultaneous writers the loop ran
out and the write failed for being unlucky.

The read-modify-write now runs with one writer at a time, holding a flock in the
repository so the SSH hook and the server queue behind each other. The
compare-and-swap stays for writers that go around the lock — a push, a hand-run
git command, another host — and losing one now waits with jittered backoff
before deciding again.

Writers read the branch once. The load and the decision happen inside the commit
instead of before it, which also stops an edit from replacing a change that
landed while the page was open: the decision is made against the tree it writes.

A push only does that work when it has metadata to move. Post-receive asks the
index which open requests follow the branch it moved, and a branch nobody is
proposing from now writes an audit line and no commit.

Measurements, 32 concurrent writers: 21.3 CAS attempts per write before, 1.0
after. Through the web, posting comments at concurrency 32: p99 4.7 s -> 0.95 s,
and throughput no longer falls as workers are added. The load harness gains a
`comment` scenario so the number is visible.

Closes: 01M6D9G8H6E0RCQ3AD5TMAGX34

docs/load-testing.md +11−1

@@ -32,7 +32,7 @@ The build needs `sqlite_fts5` beside `libsqlite3` (see
32 32
33 33 | Variable | Default | What it does |
34 34 |---|---|---|
35 | `VOLE_LOAD_SCENARIO` | `clone` | `all`, or one of `clone`, `clone-large`, `blob-small`, `blob-limit`, `raw-small`, `raw-limit`, `raw-range`, `overview`, `tree`, `commits`, `compare`, `change`, `issue`, `activity`, `instance-activity`, `home`, `search-code`, `search-find`, `artifact`, `artifact-range`, `site`. |
35 | `VOLE_LOAD_SCENARIO` | `clone` | `all`, or one of `clone`, `clone-large`, `blob-small`, `blob-limit`, `raw-small`, `raw-limit`, `raw-range`, `overview`, `tree`, `commits`, `compare`, `change`, `issue`, `activity`, `instance-activity`, `home`, `search-code`, `search-find`, `artifact`, `artifact-range`, `site`, `comment`. |
36 36 | `VOLE_LOAD_CONCURRENCY` | `4` | Workers driving the scenario in parallel. |
37 37 | `VOLE_LOAD_DURATION` | `10s` | How long the workers keep going. |
38 38
@@ -58,6 +58,16 @@ is the limit that refuses rather than the per-client one. At the configured
58 58 `git_http_max_concurrent` the run stays at `200`; above it, refusals arrive as
59 59 `503` with `Retry-After`, and a clone caught by one reports the curl failure.
60 60
61 ## The one scenario that writes
62
63 Every scenario above reads. `comment` posts a comment as the fixture's writer
64 account, which is one commit on the metadata branch that every write in the instance
65 shares: the issue, the change request, the approval, and the release pointer all move
66 the same ref. It is the scenario to run after touching the write path, and the one
67 where throughput should stay flat as workers are added while latency grows with the
68 queue behind it — a rising error count or a falling throughput means writers are
69 fighting over the branch instead of taking turns.
70
61 71 ## What it reports
62 72
63 73 Per scenario: requests and throughput, latency at p50/p90/p99, HTTP statuses,