bots-garden/razorbillpublic Fork
⑂ v1.0.0
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/razorbill.git
git clone ssh://git@rickub.com/bots-garden/razorbill.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP
watch-and-steer-a-running-server.md · 57 lines · 3.6 KBmarkdown
Blame HistoryOpen raw

How to watch and steer a running server

This guide shows how to see what a running rzb serve holds, free a model's memory, and apply a configuration change without restarting. It assumes the server runs on your Mac and you have a shell on that Mac: these routes answer the machine itself only.

See what the server holds

curl -s http://127.0.0.1:7920/rzb/status | python3 -m json.tool

models lists what is loaded, whether a request holds it (busy), how many wait (queued) and how long before keep_alive unloads it. recent_requests shows the last 50 requests with their model, tokens and duration. memory shows what MLX holds now and at its peak. To watch it change, open rzb tui in another terminal (its Dashboard refreshes every second), or repeat the call: watch -n 1 'curl -s http://127.0.0.1:7920/rzb/status'.

Free a model's memory now

curl -s -X POST http://127.0.0.1:7920/rzb/models/qwen3/unload

Use the name clients use: a declared id, or a Hugging Face id such as mlx-community/Qwen3-4B-4bit (the / stays as is in the path). The answer says unloaded, or not_loaded when there was nothing to free.

In rzb tui, select the model on the Dashboard and press u: the answer shows under the requests.

If the answer is a 409 model_busy, a request is generating with the model or waiting for it. Nothing was unloaded: retry once busy is false and queued is 0 in the status. The next request for the model loads it again.

Apply a configuration change without restarting

  1. Edit the file the server was started with (rzb serve --config server.yaml).

  2. Check it: rzb config validate server.yaml.

  3. Tell the server to read it again, with either:

    curl -s -X POST http://127.0.0.1:7920/rzb/config/reload
    

    or, which writes the outcome to the server's log instead:

    kill -HUP "$(pgrep -f 'rzb serve')"
    
  4. Read the answer (or the log line configuration reloaded from …):

    • unloaded and unload_when_idle name the loaded models you removed or moved to another source; they are freed now, or once their requests end.
    • restart_required names the server: keys you changed that only apply after a restart (host, port, api_key_env, cors_origin): stop the server and start it again for those.

If the file has a problem, the answer is a 400 invalid_config listing it, and the server keeps the configuration it had: fix the file and reload again. A server started without --config answers 409 no_config_file: there is no file to read, so restart it with one.

Variants

  • The server has an API key: add -H "Authorization: Bearer $RZB_API_KEY" to each curl; these routes need it like /v1.
  • The server listens on another port: change 7920 in the URLs.
  • You are on another machine: the routes answer 403 local_only. Run the commands on the Mac itself, for instance over ssh, or forward the port (ssh -L 7920:127.0.0.1:7920 mac) and call http://127.0.0.1:7920 locally: the server then sees a connection from itself.

See also

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# How to watch and steer a running server

This guide shows how to see what a running `rzb serve` holds, free a model's memory, and apply a configuration change without restarting. It assumes the server runs on your Mac and you have a shell on that Mac: these routes answer the machine itself only.

## See what the server holds

```bash
curl -s http://127.0.0.1:7920/rzb/status | python3 -m json.tool
```

`models` lists what is loaded, whether a request holds it (`busy`), how many wait (`queued`) and how long before `keep_alive` unloads it. `recent_requests` shows the last 50 requests with their model, tokens and duration. `memory` shows what MLX holds now and at its peak. To watch it change, open [`rzb tui`](../reference/cli.md#rzb-tui) in another terminal (its Dashboard refreshes every second), or repeat the call: `watch -n 1 'curl -s http://127.0.0.1:7920/rzb/status'`.

## Free a model's memory now

```bash
curl -s -X POST http://127.0.0.1:7920/rzb/models/qwen3/unload
```

Use the name clients use: a declared `id`, or a Hugging Face id such as `mlx-community/Qwen3-4B-4bit` (the `/` stays as is in the path). The answer says `unloaded`, or `not_loaded` when there was nothing to free.

In [`rzb tui`](../reference/cli.md#rzb-tui), select the model on the Dashboard and press `u`: the answer shows under the requests.

If the answer is a 409 `model_busy`, a request is generating with the model or waiting for it. Nothing was unloaded: retry once `busy` is `false` and `queued` is `0` in the status. The next request for the model loads it again.

## Apply a configuration change without restarting

1. Edit the file the server was started with (`rzb serve --config server.yaml`).
2. Check it: `rzb config validate server.yaml`.
3. Tell the server to read it again, with either:

   ```bash
   curl -s -X POST http://127.0.0.1:7920/rzb/config/reload
   ```

   or, which writes the outcome to the server's log instead:

   ```bash
   kill -HUP "$(pgrep -f 'rzb serve')"
   ```

4. Read the answer (or the log line `configuration reloaded from …`):
   - `unloaded` and `unload_when_idle` name the loaded models you removed or moved to another source; they are freed now, or once their requests end.
   - `restart_required` names the `server:` keys you changed that only apply after a restart (`host`, `port`, `api_key_env`, `cors_origin`): stop the server and start it again for those.

If the file has a problem, the answer is a 400 `invalid_config` listing it, and the server keeps the configuration it had: fix the file and reload again. A server started without `--config` answers 409 `no_config_file`: there is no file to read, so restart it with one.

## Variants

- **The server has an API key**: add `-H "Authorization: Bearer $RZB_API_KEY"` to each `curl`; these routes need it like `/v1`.
- **The server listens on another port**: change `7920` in the URLs.
- **You are on another machine**: the routes answer 403 `local_only`. Run the commands on the Mac itself, for instance over `ssh`, or forward the port (`ssh -L 7920:127.0.0.1:7920 mac`) and call `http://127.0.0.1:7920` locally: the server then sees a connection from itself.

## See also

- Every field and status of these routes: [HTTP API reference](../reference/http-api.md#local-admin-routes-rzb).
- What each key does on reload: [configuration reference](../reference/configuration.md#reloading).
- Why these routes exist and stay local: [OpenAI compatibility](../explanation/openai-compatibility.md#routes-of-our-own-under-rzb); how unloading fits the model lifecycle: [model lifecycle](../explanation/model-lifecycle.md#unloading-on-demand-and-reloading).