Repository navigation
/health names the release, the backend and the GPU it serves on - #854
Conversation
The open /health adds `version`, `backend` and `device` after its existing keys, for example
"1.0.10", "metal" and "Apple M5 Max", or "cuda" and "NVIDIA GB10". The binary reads them once at
startup: the version from the build, the backend from the built-in engine module, and the name of
the GPU a serve opens (the Metal system device, or the CUDA device that --device or TF_CUDA_DEVICE
picks). A field that is not known is left out, so an engine-less build sends the same body as before,
and with keys configured /health still sends only {"status": "ok"}.
…ked over a socket
The version is always the build's, so a binary with no engine module names it too. The earlier commit
said such a build sends the same body as before; that holds only for the test servers, which set no
identity. The identity now comes from `of` in identity.zig. engines.zig calls it with the built-in
engine module, and the tests call it with stand-in modules: one with a GPU, one that finds no GPU, and
one with no backend, as native/none.zig declares it.
A new test serves /health over a loopback socket with a key configured and a full identity. With and
without a valid key the body is exactly {"status": "ok"}, while /v1/models answers 401 and 200, so the
gate is on and the key is valid. The API docs say the version is named whenever keys are off.
|
Thanks, @ThinkOffApp. Ready; we'll fix the test cleanup at landing. At 8884431, We'll make cleanup cancel or join all connection workers before freeing the server, including timeout paths. The production identity refactor preserves the existing behavior, and keyed |
|
Thank you, @ashhart. Agreed on the cleanup: joining every connection worker before the server is freed is the right fix. |
… so cuda.zig stays under 600 lines #854's deviceName took native/cuda.zig to 607 lines. chip, deviceName, chipClass, getenv, envNumber and setting move unchanged with their two tests (getenv and setting become pub for cuda.zig); cuda.zig is 555 lines.
…back test never frees the server under one The /health test waited at most 5 s for open connections to reach zero and then freed the server, its keys and the engine and text on its stack, even if a connection thread still ran. Its quiesce now stops the test with a panic after 5 s rather than free anything a live thread reads. The count also rose only once a connection's thread ran, so zero after the accept loop ended did not prove that an accepted connection had no thread still to start; serve() now counts each connection before spawning its thread (and uncounts it if the spawn fails), which also makes the server's own shutdown wait exact.
…status_routes.zig) Layout only, by zig fmt after closing commas; two one-statement for bodies take braces.
|
Thank you, @ThinkOffApp. One identity builder that the tests call, and a Both commits ship in TensorFold 1.0.12 as they are, merged in The host suites pass on macOS and Linux, and every model in the release gate served the same replies with it in the build. Posted by Ash's AI Assistant Synthena |
… it serves on serve.zig's server config keeps the candidate's saved_conversations beside the head's identity.
… so cuda.zig stays under 600 lines ashhart#854's deviceName took native/cuda.zig to 607 lines. chip, deviceName, chipClass, getenv, envNumber and setting move unchanged with their two tests (getenv and setting become pub for cuda.zig); cuda.zig is 555 lines.
…s loopback test never frees the server under one The /health test waited at most 5 s for open connections to reach zero and then freed the server, its keys and the engine and text on its stack, even if a connection thread still ran. Its quiesce now stops the test with a panic after 5 s rather than free anything a live thread reads. The count also rose only once a connection's thread ran, so zero after the accept loop ended did not prove that an accepted connection had no thread still to start; serve() now counts each connection before spawning its thread (and uncounts it if the spawn fails), which also makes the server's own shutdown wait exact.
…y.zig, status_routes.zig) Layout only, by zig fmt after closing commas; two one-statement for bodies take braces.
… the Health table (ashhart#866) ashhart#866 documented the open /health fields as public main had them; ashhart#854, landed first, appends version, backend and device after live. The merge kept ashhart#866's shorter route row, so the three fields are listed in its table instead.
…shhart#862, ashhart#863, ashhart#864, ashhart#866, ashhart#821, ashhart#822, ashhart#823, ashhart#851, ashhart#738, ashhart#523, ashhart#547 and ashhart#875, with the HIP and loader fixes
What this changes
The open
GET /healthnow also names the TensorFoldversion, the GPUbackendand the GPUdevice. A monitor can then show which release runs on which GPU without a shell on the machine.The server reads the three values once at startup. The version comes from the build. The backend is the built-in engine module's
backendsentry (metalorcuda). The device is the Metal system GPU, or the CUDA device that--deviceorTF_CUDA_DEVICEpicks, read withcuDeviceGetNameand no context.The new keys come after the existing ones. The existing keys and their order do not change. The version is always named. A backend or device the binary does not know is left out: a backend module without
deviceNamereports its backend without adevice, and a binary with no engine module names only the version. The parity test servers set no identity, so their bodies, and the frozen goldens, are unchanged. With keys configured,/healthstill sends only{"status": "ok"}.The second commit moves the three values into one builder (
zig/src/server/identity.zig) that the binary and the tests both call, and adds a socket test for the keyed body.Receipt
Model: TensorFold/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-MLX-4bit, revision d9d758f. Machines: an Apple M5 Max with 128 GB (macOS 27.0.1) and an NVIDIA GB10 (Ubuntu 24.04, driver 580.178.04, CUDA 13.0).
-Dversion=1.0.11and Zig 0.17.0; the earlier live runs name their own base. The Mac build iszig build native -Dcpu=apple_m1with the macOS 27.0 SDK. The GB10 build iszig build native -Dsm=121with nvcc 13.0. Native builds only, so no MLX or PyTorch.tools/bench_concurrent.py --alone --serialortoken_shaagainst"draft": false: not run. The change does not touch requests, lanes, drafts or sampling.tools/bench_openai.py: not run, for the same reason.tools/prefill_cold.py: not run, for the same reason.Host tests, on the M5 Max and the GB10, each from a fresh tree of the commit:
zig build test test-golden -Dcpu=apple_m1test-golden, in the command abovezig build test-cuda-hostzig build test-goldenzig build native -Dsm=121The three new tests are in
zig/src/server/health_test.zig. The Mac runs them in two test binaries, so its count grows by 6; the GB10 runs them once.Two tests call the identity builder with stand-in engine modules (a GPU, no GPU found, no backend) and check the open body's keys in order. The third serves
/healthon a loopback socket with a key configured and a full identity, and checks the body is exactly{"status": "ok"}with and without a valid key, while/v1/modelsanswers 401 without the key and 200 with it.Each test fails on a broken variant, run once on the second commit before the rebase; the rebase changed neither commit's patch. The tests do not compile on main, which has no
identity.zig. With the three new keys removed from the open body, or put beforelive, the two body tests fail. With the keyed path sendingversion,backendanddeviceafter its status, or with the keyed early return removed, the socket test fails. With the builder leaving out the version when there is no backend, the engine-less test fails.zig fmt --checkis clean on both commits.tools/zig/lean_check.pyreports 527 problems on main at c7137bb and on this branch, all inherited; the changed and new files add none.Live
/health, model and machines as above. Each binary served the model with--parallel 1 --context 8192for a minute, and/healthwas read three times. Every read on a machine gave the same body.M5 Max, this branch at 8884431:
{"status": "ok", "model": "NVIDIA-Nemotron-3.5-Lightning-30B-A3B-MLX-4bit", "model_ids": ["NVIDIA-Nemotron-3.5-Lightning-30B-A3B-MLX-4bit"], "max_batch_size": 1, "warming": false, "memory": {}, "live": {"connections": 0, "waiting": 0, "decode_tokens_per_second": 0.0, "prefill_tokens_per_second": 0.0}, "version": "1.0.11", "backend": "metal", "device": "Apple M5 Max"}The runs below were made before the rebase onto 1.0.11, on main at 1e76a70 and on the first commit's patch over it, built with
-Dversion=1.0.10. The GB10 served the checkpoint's snapshot folder, so its served name is the revision. The second commit does not change the CUDA lookup, so the GB10 was not served again.M5 Max, main at 1e76a70:
{"status": "ok", "model": "NVIDIA-Nemotron-3.5-Lightning-30B-A3B-MLX-4bit", "model_ids": ["NVIDIA-Nemotron-3.5-Lightning-30B-A3B-MLX-4bit"], "max_batch_size": 1, "warming": false, "memory": {}, "live": {"connections": 0, "waiting": 0, "decode_tokens_per_second": 0.0, "prefill_tokens_per_second": 0.0}}GB10, main at 1e76a70:
{"status": "ok", "model": "d9d758fb83953437f7263256b0d96157e2a348b8", "model_ids": ["d9d758fb83953437f7263256b0d96157e2a348b8"], "max_batch_size": 1, "warming": false, "memory": {"active": 19966017136, "cache": 0, "peak": 19966017136}, "live": {"connections": 0, "waiting": 0, "decode_tokens_per_second": 0.0, "prefill_tokens_per_second": 0.0}}GB10, the first commit over 1e76a70:
{"status": "ok", "model": "d9d758fb83953437f7263256b0d96157e2a348b8", "model_ids": ["d9d758fb83953437f7263256b0d96157e2a348b8"], "max_batch_size": 1, "warming": false, "memory": {"active": 19966017136, "cache": 0, "peak": 19966017136}, "live": {"connections": 0, "waiting": 0, "decode_tokens_per_second": 0.0, "prefill_tokens_per_second": 0.0}, "version": "1.0.10", "backend": "cuda", "device": "NVIDIA GB10"}With an API key file configured, the first commit's binary over 1e76a70 on the M5 Max answered
/healthwith{"status": "ok"}, with and without a valid key, and/v1/modelswithout a key with 401. The socket test above now checks this on every run.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.The two unticked items were not measured. The change does not touch the token path or the prompt path.