mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4049] [Engine] replicas: each replica its own server on its own port, with one shared expert arena #4887
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4887
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4049
Author: @furkangkhsn
Created: 10/25/2026
Status: 🔄 Open
Base:
main← Head:replica-ports📝 Commits (8)
f33d5e1serve: replicas port mode - the config check (all entries have a port, or none)9560c58serve: replicas port mode - each replica's run config and command line062bf2eserve: replicas port mode - the supervisor (one server per replica port, shared arena)27edc17docs: replicas port mode and the shared arena440ab2bserve: replicas port mode - probe over loopback, refuse lazy, keep each replica's shared settings next to the config60522a5serve: replicas port mode - each replica's run config is a new owner-only file6d16f66serve: replicas port mode - refuse split_serve, as the in-process replicas do26ee90fserve: replicas port mode - the shared arena follows the server's own plan📊 Changes
4 files changed (+491 additions, -1 deletions)
View changed files
📝
docs/MULTI_GPU.md(+28 -0)📝
serve/replicas.py(+198 -0)📝
serve/server.py(+16 -1)📝
serve/test_replicas.py(+249 -0)📄 Description
Problem and result
Running one engine per card with one shared arena (#127, #129) needs hand-written run configs, a start script that waits for each server, and manual cleanup. With this PR, a run config whose
replicasentries all have a"port"does it in one start:replica_shared_arenaand the next ones attach, each pinned to its own cores.Related discussion
Issue #4047; the design follows #127 (independent lanes) and uses the arena from #129. Scope not yet agreed: draft until you answer.
Approach
"replica_shared_arena": true(a memfd, or a file in/dev/shm). Port mode now takes the same value through the sameshared_arena_plan, so a memfd is used here too; a file path still names the file. The option no longer implies ports, and the earlier--replica-shared-arena FILEflag is gone.serve/replicas.py(port_mode,port_child_cfg,child_argv,run_port_mode) plus one branch early inmain(), before saved tuning and flag handling, because each child applies those itself. NoService, endpoint or engine change.lifeline.popen(parent-death signal on Linux, job object on Windows) in their own session./healthreportsloaded: true, probed over loopback with no proxy.<name>.replica<i>.json, owner-only and removed at stop, so its shared Chat settings file survives restarts.--lazy/lazy_load(a lazy child never reports loaded);--ready-file/--owner-fd;Validation
Passed:
python -m unittest discover -t . -s serve -p 'test_*.py'on mainc62d5e3a(0.2.9) + this branch, Linux, Python 3.14: 1316 tests, 2 failures:GpuChoice.test_hip_ordinalandtest_keepawake...early_close. Clean mainc62d5e3ahas the same two (1298 tests). Earlier the same on 0.2.7.1, 0.2.6, v0.2.4.2 and v0.2.3.1. New tests inserve/test_replicas.py: real servers with--engine mock, covering:split_serverefused (it starts its own engines, as the in-process replicas already say);HTTP_PROXYset and--host 0.0.0.0;serve/changes applied to that tree's identicalserver.py/replicas.py/lifeline.py. One run config,"gpu": [0, 1], tworeplicasentries with ports 8080 (--max-context 524288, YaRN x2) and 8081 (--max-context 131072),"replica_shared_arena": "/tmp/strata-iq3xxs.arena".Startup: both servers up 42 s after the start;
/healthshowed 524288 and 131072. The second replica attached to the arena the first one filled.One arena copy: the 42.9 GB file was mapped by both engines and
Shmemwas 43.5 GB. Each child server was pinned to its own half of the cores (0-7,16-23/8-15,24-31).Concurrent decode, one streamed 512-token request per port at the same time, 3 rounds, medians:
Engine killed:
kill -9of the 8081 engine left 8080 untouched (same engine, answered at once). 8081's own server restarted its engine and answered again 31 s later, and the supervisor did not react.Stop: SIGTERM to the supervisor ended both servers and both engines in 5 s. Both ports were closed, the arena file and the per-replica run configs were deleted, and
Shmemwas back to 0.6 GB.Failed: none observed.
Not run:
"replica_shared_arena": true(the memfd) in port mode on real hardware: tested with--engine mockonly, which does not open the arena. The real-hardware run above used a file path on an older tree.Limits
strata launch/ the app do not write port mode yet; a setup option can follow if this is accepted.🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.