Artifact 72d2f145562e43d4d3bb43f0d1ef5feab6de0070f576a33fd58cc0faccec6208:
- File
internal/events/bench_test.go
— part of check-in
[bbe731e042]
at
2026-08-17 16:40:19
on branch trunk
— deploy: Dockerfile, compose stack and a run book
quarry had no packaging at all while notify already had a working Dockerfile and compose. The image ships zit WITH quarry, deliberately: 0001 §2 makes the zit CLI the entire store interface, so zit's behaviour IS quarry's, and today alone three zit builds changed what quarry does — frames got faster, a card fix changed which artifacts parse, stat -R enabled bare-store serving. ZIT_REF is a build argument and /etc/quarry-build records the pair, so a container can answer which zit it carries.
compose follows notify's shape, including the constraint its own file documents: dagnats binds loopback in standalone mode, so everything shares its network namespace. quarry joins it too — its embedded NATS uses DontListen and binds nothing, so there is no port to collide with.
docs/running.md is the by-hand path, which is what this was actually developed against: the launchd-signed dagnats, notify's bootstrap and workflows, the topic-vs-subscriber addressing, and the two credentials that close the write and push gates.
Unverified, and said so in the doc: no container runtime is installed here, so the images have never been built. The two build recipes inside them ARE verified natively — zit compiles from a clean clone with zig build --release=fast, quarry builds fully static with CGO_ENABLED=0.
Also lands the publish-throughput measurement as an opt-in test. It is what disproved the hypothesis that synchronous publish was the ingest bottleneck (62k msg/s sync), which redirected the search to zit frames and quarry's folding. (user: dmestas, size: 1936) [annotate] [blame] [check-ins using]
package events import ( "fmt" "os" "testing" "time" "github.com/nats-io/nats.go" ) // Where does ingest time actually go? Compare sync publish (what watch() // does today) against async batched publish, same payload shape. // // This MEASURES rather than asserts, so it is opt-in: it would otherwise // add seconds to every run and report a number nobody reads. Run it with // // QUARRY_BENCH=1 go test ./internal/events -run PublishThroughput -v // // It is kept because of what it settled on 2026-08-16: the hypothesis // that synchronous publish was the ingest bottleneck was WRONG — sync // managed 46,700 msg/s, about a second for a 41k-artifact store. The // real cost was elsewhere (zit frames, and quarry's own folding), and // this is the evidence that redirected the search. func TestPublishThroughput(t *testing.T) { if os.Getenv("QUARRY_BENCH") == "" { t.Skip("set QUARRY_BENCH=1 to measure publish throughput") } ev, err := Start(t.TempDir()) if err != nil { t.Fatal(err) } defer ev.Close() payload := make([]byte, 1200) // a typical parsed-manifest JSON const n = 3000 start := time.Now() for i := 0; i < n; i++ { if _, err := ev.JS().Publish("zit.evt.bench.artifact", payload); err != nil { t.Fatal(err) } } sync := time.Since(start) start = time.Now() var last nats.PubAckFuture for i := 0; i < n; i++ { f, err := ev.JS().PublishAsync("zit.evt.bench2.artifact", payload) if err != nil { t.Fatal(err) } last = f } select { case <-ev.JS().PublishAsyncComplete(): case <-time.After(30 * time.Second): t.Fatal("async publish did not drain") } _ = last async := time.Since(start) fmt.Printf("\n sync : %v for %d msgs = %.0f msg/s\n", sync.Round(time.Millisecond), n, float64(n)/sync.Seconds()) fmt.Printf(" async: %v for %d msgs = %.0f msg/s (%.1fx faster)\n\n", async.Round(time.Millisecond), n, float64(n)/async.Seconds(), sync.Seconds()/async.Seconds()) }