Deployment posture
Stateless vs stateful as deployment posture โ the same C++ binary, two state choices.
Architecture and flow diagrams for the statelessness compendium.
Click any diagram to open it fullscreen. Each is also available as
.excalidraw source โ open it on
excalidraw.com
to edit.
Stateless vs stateful as deployment posture โ the same C++ binary, two state choices.
RequestContext as RAII per-request scope: ctor acquires, dtor releases on every exit.
PMR monotonic_buffer_resource: bump-pointer per request, single bulk free at scope-end.
The State Architecture Table: process-scoped, request-scoped, external โ sort early.
Threading in a cgroup-constrained service: cpu.max budgets the worker pool.
12-Factor adapted to C++: nine map directly, three collide (Config, Processes, Disposability).
State externalization: process-scoped pool, ScopedConnection RAII, authoritative state outside the process.
Outbox: order + event written in one transaction; a relay publishes with FOR UPDATE SKIP LOCKED; an idempotent consumer applies ON CONFLICT โ at-least-once delivery plus idempotent apply = exactly-once effect.
The ephemeral filesystem: overlayfs scratch + tmpfs vanish on restart, only PVCs persist, logs to stdout.
Three probes (startup, liveness, readiness) and the graceful-shutdown sequence that ties scope destructors together.
Health states (Starting โ Serving โ NotReady โ Draining โ Stopped) and the ordered SIGTERM shutdown sequence: flag, drain readiness, stop workers, Shutdown(deadline), reverse-order teardown, exit 0.
gRPC end-to-end example: a complete order-pricing service composing process-, request-, and external-scope state.
Conan dev vs release profiles: same sources, same lockfile, two parallel build flows producing two binaries.