aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


tools/stress/README.md (4812B)


Headless server load test

Build and run against a disposable server built with -tags=e2e. The setup API is intentionally absent from normal builds. Each run creates new players; start each comparison with a fresh database and the same assets.

go build -o /tmp/ao-stress ./tools/stress
/tmp/ao-stress -url http://127.0.0.1:PORT -clients 100 -ramp 30s -duration 2m

The default distributed.json puts 70% of clients in Omni-1 Entertainment (705), 20% in Newland City (800), and 10% in the starter backyard (950). The cities each use five separated locations. At each location 80% of clients are idle and 20% walk for two seconds, rest for eight, and reverse on the next leg. Walking poses describe a controlled two-metre leg, not a full native physics implementation. These are synthetic placements, not measured production player behavior.

Use -scenario tools/stress/hotspot.json for the dense crowd: everyone is active, with one location per zone. Keep this worst case separate from distributed load. -scenario accepts weighted spawn locations with Activity set to idle, walk or crowd. Weights are assigned deterministically in client order. Both supplied scenarios retain the same 70/20/10 zone split.

Provisioning completes before measurement. The client then schedules connections throughout the ramp, authenticates through /browser-world, waits for the world snapshot, sends CharacterReady, and waits for its acknowledgement. It continuously reads the actual game byte stream using the compact 14.9.1 protocol, including quantized movement, native N3 headers and packet alignment. No browser or renderer is involved. Received byte counts include packet alignment but exclude WebSocket, TCP/IP and TLS overhead; older full-width results excluded alignment.

Crowd clients alternate sitting/standing once per second and walk forward/backward while standing. They deliberately send both directional stops before each posture probe. Its acknowledgement passes through the simulation owner. Idle and walking clients instead use a private one-second protocol ping: these measure transport round trips, including ordered movement processing when a walker sends a command first. Idle pings alone do not demonstrate simulation responsiveness. The report's action and steady_actions fields count completed probes in either scenario; do not compare CPU/probe across different activity mixes as if the work were equal. These are movement/visibility/recovery workloads, not combat, inventory, team, chat or zone-transfer coverage.

JSON lines report cumulative admission and action latency, steady-period action latency, scheduled-action latency including client scheduling delay, received traffic, ready/disconnected clients, generator heap/goroutines, missed scheduled actions and unanswered actions. The zones object reports the same latency and throughput counters by playfield, so a hotspot cannot hide stalls in quiet zones. Compare each zone's steady_actions divided by the measured steady-window duration and its steady_action percentiles; do not infer isolation from aggregate latency. Millisecond histograms have bounded memory; the 60000 ms bucket includes all larger values. Outstanding actions at the end are reported separately. Failed connections or incomplete admission produce a nonzero exit status. Slow responses never silently reduce the expected action rate: skipped one-second deadlines are counted. A socket ping alone would not measure simulation work.

Raise load in steps: 100, 500, 1000, 2000, 5000, 10000, then 20000. For example:

/tmp/ao-stress -url http://SERVER:PORT -clients 20000 -ramp 15m -duration 5m > run.jsonl

20000 is a generator limit, not a claim about server capacity. Check file descriptor limits and run the generator on another machine for capacity measurements. Capture both processes' CPU/RSS and the server's per-zone slow-tick logs alongside the JSON. The generator's reported Go heap is not process RSS. Do not run builds or other benchmarks alongside a measured run. SIGINT cancels connections and joins readers; it does not stop the external server or delete its database.

Compare 96de3545 (before the lock initiative), 9cd2d916 (spatial/navigation work before ownership), the current production zone runtime. Build each revision separately with -tags=e2e; use this same client against each. Keep assets, scenario, hardware, durations and persistence settings fixed. Repeat runs, compare admission separately from steady load, and retain failures and missed actions. Production now runs independent zone owners. A comparison with the original baseline measures the entire initiative, including spatial queries, navigation and persistence changes; it does not isolate the cost of channels versus locks.