sgtop
A btop-style terminal dashboard for a live SGLang deployment — concurrency, KV-cache headroom, GPU utilization, and (optionally) per-request latency, all in one screen.
Not affiliated with the SGLang project. It's a small, independent, read-only sidecar: it never touches your inference traffic, it only reads sglang's own log file, nvidia-smi, and (if enabled) sglang's Prometheus /metrics endpoint.
Why
nvtop tells you a GPU is at 98% utilization. It doesn't tell you whether your sglang server can actually take more concurrent requests, whether one data-parallel replica is starving while another is idle, or what your real TTFT looks like. sgtop answers those instead:
- Concurrency vs. capacity — running requests / the actual
max_running_requestssglang computed at startup, not a guess. - KV-cache headroom — tokens in use / total KV budget, per replica.
- Per-DP-replica breakdown — if you run
--dp-size > 1, each replica gets its own panel, so an imbalanced load-balancing setup is obvious at a glance instead of hidden in an aggregate number. - Latency percentiles — TTFT / end-to-end / queue-time p50/p90/p99 over a rolling 5-minute window, once you turn on
--enable-metricson the sglang side. - GPU panel — utilization, memory, temperature, power, right below the request-level view.
Install
pipx install sgtop # recommended — isolated, puts `sgtop` on your PATH
# or
pip install --user sgtop
Requires Python ≥ 3.9 on Linux or macOS. No dependencies — it's pure standard library (curses + urllib), so there's nothing else to install.
From source:
git clone https://github.com/HarrytheOrange/sgtop
cd sgtop
pip install -e .
Quick start
sgtop is a client. It needs something to talk to: sgtop-server, a small sidecar that tails sglang's log file and exposes a JSON API. Run it on the same machine as sglang (or anywhere with network access to it):
# 1. Launch sglang, redirecting its output to a file sgtop-server can tail:
python -m sglang.launch_server --model-path ... --dp-size 2 --enable-metrics > server.log 2>&1 &
# 2. Start the sidecar, pointing it at that log file:
sgtop-server --log server.log --service-port 30000 --port 30001 &
# 3. Watch it:
sgtop --port 30001
sgtop-server also serves a plain HTML version of the same data at http://<host>:30001/ — handy if you want to glance at it from a browser instead of a terminal, or point it at a machine other than the one you're ssh'd into:
sgtop --host 10.0.0.5 --port 30001
--enable-metrics (optional, recommended)
Without it, sgtop still shows concurrency, KV-cache usage, throughput and GPU stats — all parsed from sglang's own log lines, no extra flags needed.
Add --enable-metrics to your launch_server command and the LATENCY panel comes alive with TTFT, end-to-end latency, per-replica queue time, and prefix-cache hit rate, scraped from sglang's Prometheus endpoint. sgtop-server diffs consecutive scrapes itself to give you a real rolling-window p50/p90/p99 instead of an all-time average — Prometheus histograms are cumulative counters, so a naive read would just show a number that keeps drifting toward whatever the very first few requests looked like.
Keybindings
q to quit. That's it — it's a dashboard, not an editor.
How it works
sgtop-servertails the log file sglang writes when you redirect its stdout/stderr, extracting the periodicDecode batch/Prefill batchlines each DP replica prints, plus the one-timemax_total_num_tokens=... max_running_requests=...line printed at startup. It samplesnvidia-smion an interval, and if--enable-metricsis on, scrapes/metricsand keeps a short rolling window of histogram deltas for latency percentiles. All of it is exposed as JSON at/api/status.sgtoppolls that JSON and renders it withcurses— gradient meters, sparkline history, boxed panels, degrading gracefully to a 3-color/16-color palette on terminals without 256-color support.
Both are plain Python, no compiled extensions, so pipx install is instant.
License
MIT — see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sgtop-0.1.0.tar.gz.
File metadata
- Download URL: sgtop-0.1.0.tar.gz
- Upload date:
- Size: 22.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87eba1e62bb6e17e9b62ccb36f83928d307817c8a1528f81496ab471e4d07e3e
|
|
| MD5 |
7205eea28473fe2376b9d1b06541c8da
|
|
| BLAKE2b-256 |
ef16c619cdce0caab5b195c15c020502feb2c66d444b81939304e9783f38c9aa
|
Provenance
The following attestation bundles were made for sgtop-0.1.0.tar.gz:
Publisher:
publish.yml on HarrytheOrange/sgtop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sgtop-0.1.0.tar.gz -
Subject digest:
87eba1e62bb6e17e9b62ccb36f83928d307817c8a1528f81496ab471e4d07e3e - Sigstore transparency entry: 2697177046
- Sigstore integration time:
-
Permalink:
HarrytheOrange/sgtop@d52dbb3779876b1f9d2fe68206f42e820a2218ea -
Branch / Tag:
refs/tags/v1.0 - Owner: https://github.com/HarrytheOrange
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d52dbb3779876b1f9d2fe68206f42e820a2218ea -
Trigger Event:
release
-
Statement type:
File details
Details for the file sgtop-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sgtop-0.1.0-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29bbfcfdece62893db2f98e55d56c7ce697e49424d65dfc21fa4093a2fa4d224
|
|
| MD5 |
7f4a0dc642787ca2c843fd643b15a816
|
|
| BLAKE2b-256 |
e2af6607fa7e678f0b10c497690e550c0e6a2bbc116d6363021055846c658619
|
Provenance
The following attestation bundles were made for sgtop-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on HarrytheOrange/sgtop
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sgtop-0.1.0-py3-none-any.whl -
Subject digest:
29bbfcfdece62893db2f98e55d56c7ce697e49424d65dfc21fa4093a2fa4d224 - Sigstore transparency entry: 2697177081
- Sigstore integration time:
-
Permalink:
HarrytheOrange/sgtop@d52dbb3779876b1f9d2fe68206f42e820a2218ea -
Branch / Tag:
refs/tags/v1.0 - Owner: https://github.com/HarrytheOrange
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d52dbb3779876b1f9d2fe68206f42e820a2218ea -
Trigger Event:
release
-
Statement type: