mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #2838] [CLOSED] serve: cap the expert arena at a share of RAM ("arena_budget"), and a STOP.bat that only stops Strata #4294
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#4294
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/2838
Author: @regdiliKUN
Created: 10/17/2026
Status: ❌ Closed
Base:
main← Head:feat/arena-budget-stop📝 Commits (1)
2e4f92dserve: cap the expert arena at a share of RAM ("arena_budget"), and a STOP.bat that only stops Strata📊 Changes
7 files changed (+611 additions, -0 deletions)
View changed files
➕
STOP.bat(+13 -0)📝
docs/AI_SETUP.md(+8 -0)📝
docs/DETAILS.md(+52 -0)➕
serve/arena_budget.py(+194 -0)📝
serve/server.py(+2 -0)➕
serve/test_arena_budget.py(+159 -0)➕
stop-strata.ps1(+183 -0)📄 Description
What this changes
Two things, both from one machine's problem: a 63.7 GiB PC with a 68 GB IQ2_XS model that could not hold its own expert arena.
1.
"arena_budget"— a cap on the arena, as a share of RAM (opt-in)The engine sizes the arena from what the machine has free at start, which is the wrong size on a PC that is also used for something else. On the machine above it asked for 33.02 GiB and said so:
and from there the load swapped,
cudaHostRegisterof the whole arena failed, the large pages were refused (VirtualAlloc error 1450) and the run fell back to 4 KB pages. Decode ran beside 2.6 MB/s of disk and 43% CPU.A fixed number is the wrong shape for a fix — 28 GiB is generous on a 32 GB PC, wasteful on a 128 GB one, and wrong again the moment the PC is used for something else. So the key is a share of physical RAM, and the GiB are computed at every start from the RAM that PC actually has:
"auto"(an absent key is the same)"auto",true, a number, or an object"auto"/absent: no cap, the engine sizes the arena itselfshare0.45(also whattruemeans)0.10–0.85min_gib6>= 1headroom_gib8>= 0The cap is
clamp(share × total RAM, min_gib, total RAM − headroom_gib), rounded down to whole GiB, so it follows the hardware:0.45is 7 GiB on a 16 GB PC, 14 on 32 GB, 28 on 64 GB, 57 on 128 GB.min_gibnever beatsheadroom_gib: on a PC too small for both, the cap is skipped rather than made impossible.How it takes effect. Computed at start and passed as the engine's own
--resident-budget-gib N.--resident-budget-gibalone —generate.cpp:2223already setsmmap_experts/resident_cpu_experts/resident_pinwhen it parses it, so--mmap-expertswould be redundant, and it is refused beside some pack layouts. Read at start, so a change is used from the next start; the server prints the arithmetic once:A value out of range, of the wrong type or with an unknown key is said once and then ignored, with the engine sizing the arena as before: a typo never stops a start.
2.
STOP.bat/stop-strata.ps1— stop Strata, and only StrataReplaces the recipe it was written to replace, which ends every
python.exeon the PC and with it a Jupyter kernel, a build script or another model server:A process is now stopped only when one of two rules names it:
serve\server.py(its own interpreter inside the install, or the install's absolute script path in the command line);strata.exe/strata-vision.exewhose executable sits inside the install.The launcher goes first, so a supervisor cannot restart the engine behind us. Each process gets a plain
taskkill(WM_CLOSE) and only then/F. A process whose path cannot be read is reported and left alone rather than guessed. No match prints没有找到正在运行的 Strataand exits 0, so running it twice is safe.-WhatIflists what would be stopped and stops nothing;-Rootpoints it at another install.What it leaves alone
arena_budgetadds nothing to the engine's arguments —serve/test_arena_budget.py::Wiring::test_engine_args_without_the_key_is_byte_identicalasserts exactly that.--resident-budget-gibalready written into the config's"args"is never overridden: the number written by hand wins.warn_budget_over_ram(#1080) is unchanged and still reports a share that ends up larger than the RAM this PC has free.src/,include/or the setup path changes: no engine rebuild, no backend touched.How it was checked
python -m unittest serve.test_arena_budget— 22 pass, no GPU and no model needed (shares on 16/32/64/128/256 GB, both clamps, the floor never beating the headroom, out-of-range and wrong-type refusals, a hand-written budget winning, the line said once per start, and theengine_argswiring).python -m unittest serve.test_runconfig— 9 pass (no regression in the Settings view).from serve import serverimports clean;engine_args({"args": [...]})without the key returns the list unchanged.python.exewhose command line mentionsserve\server.pyand the install path but whose executable lives outside the install was left running. A second run found nothing and exited 0. The decoy case is the regression that the first version of the rule failed, which is why rule 1 now needs the full absolute script path, not just the install path somewhere in the command line.[System.Management.Automation.Language.Parser]::ParseFile(0 errors) and are UTF-8 with BOM (stop-strata.ps1) / pure ASCII (STOP.bat), CRLF.Not tested: a real engine start with the cap on a second machine, and the stop script against a genuine
strata.exe(the engine had already exited when the fake-install run was made). The cap's effect on decode speed on this model is the trade the user chooses — the numbers inbench/results/2026-10-01-iq4xs-64gbsay a RAM budget costs ~30% against a warm mapped run at that size, which is why this stays opt-in rather than a new default.Files
serve/arena_budget.pyserve/test_arena_budget.pyserve/server.pyengine_argsSTOP.bat,stop-strata.ps1docs/DETAILS.mddocs/AI_SETUP.md🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.