Add the Egg implementation as an optional app
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:
eggin 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):
| Route | Rust | Egg | Egg/Rust |
|---|---|---|---|
| Room page | 13,789 | 49,051 | 3.6× |
| Messages page | 11,807 | 45,301 | 3.8× |
| Sidebar | 12,613 | 61,308 | 4.9× |
| Search | 12,620 | 52,558 | 4.2× |
| Avatar | 42,810 | 56,726 | 1.3× |
| Static CSS | 49,718 | 99,995 | 2.0× |
| /up | 21,688 | 120,968 | 5.6× |
| Post a message | 1,452 | 2,409 | 1.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_KEYstopped our app from starting: we compared it as text with our own unpadded encoding. It is fixed onmain. - 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.