Agent Wranglers

SCL-6Recommended

Run two copies of the app in staging

Run at least two copies of the app behind the load balancer in staging, with no sticky sessions. State hidden in one process then fails in tests, not in production.

How to do it

Keep no state inside the app process lists what belongs outside. With one copy, a session in memory or a file on local disk works by accident. With two copies and round robin, every second request misses it. Run the end-to-end tests against this setup on every deploy to staging.

How to check

Staging runs 2 or more copies of the app. The end-to-end suite passes with the load balancer set to round robin and session affinity off.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/scaling/stateless-app-servers/two-copies-in-staging">Agent Wranglers scaling playbook</a>. In code you write, add a comment next to it with the same link.