B7.6.3 · dive 3 of 3 · module B7.6
Production on Fly.
The whole game runs as one long-lived application — a single supervised tree over the database, PubSub, the bus and its workers, and the endpoint — with no ephemeral tier, deployed and scaled as Machines on Fly.
The idea
codemojex · production on flyThe whole game is one long-lived application, and the application is the deployment. Under a single supervisor sit the database connection, the PubSub, the bus with its score workers, and the Phoenix endpoint; if one of them crashes, its subtree is restarted in place rather than the machine torn down. The supervision tree from the earlier chapters is, here, the shape of the running service.
There is no ephemeral, scale-to-zero job tier, and that is a deliberate reading of the load. Guesses arrive as a steady stream rather than in rare spikes, and a settlement is a single batch pass at a game’s close, not a fleet of short-lived jobs. A persistent service sized to that load is simpler to reason about than machines that come and go, so the reference design keeps one app running.
It deploys on Fly Machines as that one service, close to its players and its data. Scaling is adding instances of the same supervised tree, not a separate worker fleet, and the bus and its lanes already partition the work across them by branded id. The general treatment of running BCS on Fly — regions, machines, and the rest — is the subject of the next chapter; here it is enough that Codemojex ships as a single, supervised, persistent app.
The doors
the sibling coursesEchoMQ — the protocol, in depth
The bus B3 narrates, taught rung by rung: the keyspace, the Lua inventory, and the 3.0 Stream Tier — XADD, XREADGROUP, XACK — with conformance on Valkey.
Redis Patterns Applied
The substrate patterns under the bus: sorted sets, atomic Lua moves, locks, and streams — the judgement layer.
/echo-persistenceEcho Persistence — the durable floor
Beneath the volatile tiers: the Graft page engine built twice, the commit-LSN loop, and the stream archive on Tigris. Where Part I says state lives somewhere, this says where it lives durably.
References
sources · relatedSources
- Erlang/OTP — the gen_server behaviourthe supervised processes the bus, its workers, and the endpoint run as
- Fly.io — Fly Machines (fast-launching VMs)the persistent, supervised app shipped and scaled as Machines on Fly
- The Go Blog — Share Memory By Communicatingthe worker decoupled from the crowd, scaling as more trees by message
Related
- BCS — the course homethe law, the id anatomy, the chapter map
- Echo Persistencethe durable floor beneath the bus