Skip to content

Add the Egg implementation as an optional app - #14

Open
femto wants to merge 2 commits into
basecamp:mainfrom
femto:add-egg-implementation
Open

femto wants to merge 2 commits into
basecamp:mainfrom
femto:add-egg-implementation

Conversation

@femto

@femto femto commented Nov 9, 2026

Copy link
Copy Markdown

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):

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_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

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.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 06:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Numeric zero cache overrides are passed correctly to Docker but recorded as enabled in bench/compare.rb, causing the reported topology to misrepresent the benchmarked configuration.

1 open issue
What changed in this PR

Adds Egg as an optional implementation in the shared Campfire verification and benchmark harness, without changing the default app list.

Changes:

  • Allows selecting Egg with --apps egg.
  • Records Egg’s HTTP workers, cable event loops, and cache configuration.
  • Documents EGG_IMAGE and how to benchmark Egg with caching disabled.

[!TIP]
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

File Description
README.md Documents optional Egg selection, image overrides, and cache controls.
bench/​compare.rb Allows Egg and adds implementation-specific topology metadata.

Review effort: Balanced

Comment thread bench/compare.rb Resolved
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants