Skip to content

One machine until the load says otherwise, and a $25 monthly ceiling

Context and problem

Each table lives in the memory of the one server process (fly.toml, decision 0012), so a second machine is not a setting: it needs tables to have one owner across machines, a real piece of work. The architecture review of 2026-11-25 asked when that work should start. The server could not answer: its only signals were fly logs and Fly’s dashboard, and nothing counted connections. Homefelt is for family and friends, and its hosting is paid personally.

Options considered

  1. Plan for several machines now. Sticky routing by table and a lease per table in Postgres. Weeks of work for a load that may never come.
  2. Scale on Fly’s autoscaler. Not possible: a second machine would run the same tables twice.
  3. A load number, measured, and a bigger machine first. Count connections; grow the one machine while it can; start the multi-machine work only past a number.

Decision

We chose option 3 (Eduardo, 2026-11-25), with these numbers:

  • The rule. The work on running more than one machine starts when peak connections pass 100, half the cap of 200 (HOMEFELT_MAX_CONNECTIONS), on three evenings in one month. Before that, a bigger machine (more memory, a dedicated CPU) comes first.
  • The signal. The server exports Prometheus metrics on an internal port (src/metrics.rs, port 9091, scraped by Fly, never on api.homefelt.io), including homefelt_connections_peak. At 100 open connections it raises connectionsHigh, pushed to Eduardo’s phone.
  • The ceiling. Hosting stays under $25 a month across Fly, Neon and Vercel. Vercel stays on Hobby, which is never billed; Neon’s spending notifications and Fly’s billing dashboard show the rest. Past it Eduardo decides. Nothing scales or upgrades on its own.
  • The alerts. They go to a private ntfy topic (decided 2026-11-26): from the server for load and the move log, and from a Vercel Function outside Fly for /health, called every 5 minutes by a free external pinger.

How to read the numbers and set the alerts: deploy.md, “Watching the server”.

Consequences

  • One machine stays the design, and its limits are watched rather than guessed.
  • A busy evening is a notice on the phone, not an outage: the cap of 200 still refuses connections past it.
  • Vercel Hobby runs crons once a day, and Pro ($20 a month) would take most of the ceiling, so a free external pinger (cron-job.org) calls the health check every 5 minutes (Eduardo, 2026-11-26).
  • Revisit when the rule fires, or when the ceiling is reached.