Add the Egg implementation as an optional app

FE
12d ago
+6-4

This adds once-campfire-egg, a port of Campfire to Egg, as an optional egg app. Select it with --apps egg and EGG_IMAGE (default once-campfire-egg:app; source checkout ../once-campfire-egg). It is not in the default app list.

The change:

  • egg in the allowed apps;
  • its topology record: HTTP workers (CAMPFIRE_WORKERS), cable event loops (CAMPFIRE_CABLE_LOOPS) and its cache, which is on by default; EGG_BENCH_ENV='{"CAMPFIRE_CACHE":"0"}' measures it uncached;
  • the README.

bin/check passes. A run with --apps rust,egg passes against main of once-campfire-egg (e152b5b), and bin/browser passes on a fresh database.

Why an Egg port

Egg is a small language with ownership instead of a garbage collector, compiled to C. We wanted a real application to find where it hurts, and numbers to compare with the other ports. Agents wrote it, with the Rust port as the reference: pages match once-campfire-rust's byte for byte. It uses the same SQLite database, storage layout, signed cookies, signed ids and Turbo stream names as Rails. C libraries (SQLite, zlib-ng, libcrypto, libcurl) are called through Egg's extern fn.

Run on our host

Intel i7-9700K, OrbStack Linux VM with 8 vCPUs; app on CPUs 0-3, load generator on CPUs 4-7; 3 alternating rounds, 16 clients. Against Rust 6dae2fd (the published image, with its caches):

RouteRustEggEgg/Rust
Room page13,78949,0513.6×
Messages page11,80745,3013.8×
Sidebar12,61361,3084.9×
Search12,62052,5584.2×
Avatar42,81056,7261.3×
Static CSS49,71899,9952.0×
/up21,688120,9685.6×
Post a message1,4522,4091.7×

All responses were valid, and the write audit verified every acknowledged post. Rust's posts varied the most between runs on this host (1,450–1,980 the same day); Egg's were 2,350–2,490. The absolute numbers are lower than in your published table because of the host.

With loadgen cable, 1,000 clients on one busy room, every message reached every client for both: 209 messages/s to all clients at full load for Egg, 186 for Rust; 47 MiB peak memory against 136.

What the harness found

  • The seed's padded Base64url VAPID_PUBLIC_KEY stopped our app from starting: we compared it as text with our own unpadded encoding. It is fixed on main.
  • Posts were about half of Rust's. Three causes, all fixed on main: every broadcast woke every cable event loop, even with no socket listening; push notifications were built inside the message's transaction; and the commit that crossed 1,000 WAL pages ran the checkpoint while holding the write lock. Checkpoints now run on their own thread, as in your Rust port.

Thank you for the strict contracts and the write audit.

Notes

  • On a host whose user is not uid 1000, the app images can't write their copy of the seed; #12 fixes that for all apps. Our runs used it.

Known gaps

  • No PDF thumbnails, and no images in remote link cards.
  • Flash notices use a cookie of our own, not Rails' encrypted session cookie.
  • Each HTTP worker keeps its own response cache, cleared on any commit (SQLite's data_version), so a write empties every worker's cache.