OptionalapiKey: stringDisposes of all resources and stops all active monitors. Call this when you're done using the stats instance.
Get the number of active child processes on the server.
By default the proxy's /activechildren endpoint will spawn children up
to the configured count if none are running, then report the count — which
wakes (and bills) an idle server. Pass { initialize: false } for a passive
read that reports the current count without spawning; use this for
monitoring or before a purge/probe where you must not wake the server.
Optionalinitialize?: booleanWhen false, append ?initialize=false so the
server reports without spawning. Defaults to true (the server's default).
Number of active children, or null if unavailable
Get how long the rhino.compute proxy has been idle.
GETs /idlespan on the proxy, which returns the seconds elapsed since the
last request was forwarded to a compute child. This is a proxy-level metric
(not proxied to a child) used by autoscalers to decide when a node can be
drained. Returns null if unavailable.
Idle time in seconds, or null on failure.
Get the plugins installed on the server.
Returns a name → version map of non-core plugins the server has loaded,
or null if the request failed. Pass kind to choose which inventory:
'gh' (default) lists Grasshopper add-on assemblies via
/plugins/gh/installed; 'rhino' lists Rhino plugins via
/plugins/rhino/installed. Plugins that ship with Rhino / are core
libraries are excluded by the server.
'gh' for Grasshopper add-ons (default) or 'rhino' for Rhino plugins.
Map of plugin name to version, or null on failure.
Get comprehensive server statistics. Fetches all available server information in parallel.
Object containing server status and available stats
Get the server's current UTC clock.
GETs /servertime, which the server emits as a JSON-encoded ISO-8601
timestamp (e.g. "2026-06-18T08:30:00Z"). Useful for detecting clock skew
between caller and server. Returns null if the request failed or the body
isn't a parseable date.
A Date for the server's UTC time, or null on failure.
Get the server version information.
Version object with rhino, compute, and git_sha, or null if unavailable
Check if the server is online.
This is a single-sample probe: it returns true only on a 2xx from the
proxy liveness root /, and false for every other outcome (non-2xx,
network error, or timeout). A cold or briefly-busy-but-up server can therefore
read as offline — callers that gate on this (e.g. client construction)
should retry rather than treat a single false as authoritative.
Abort the probe after this many ms (default: 5000).
Pass 0 to disable the timeout. Prevents a hung connection from
stalling the caller indefinitely.
Add a single compute child to the pool, optionally on a specific port.
POSTs /launch-child (with ?port=N when port is given). Unlike
launchChildren, this can push the pool above the baseline, up to the
server's MaxChildren cap. Returns { spawned: [port] } on success, or
null on failure (server replies 400 for a bad port, 409 if the port is in
use, 503 at the max-children cap).
Optionalport: numberOptional specific port to launch on; otherwise the next free one.
{ spawned } listing the launched port, or null on failure.
Fill the compute child pool up to the server's configured baseline.
POSTs /launch-children. No-op when the pool is already at or above the
configured --childcount. Returns { spawned, active } — how many children
were started and the resulting child count — or null on failure.
To raise capacity above the baseline use launchChild; the baseline itself can only be changed by restarting rhino.compute.
{ spawned, active }, or null on failure.
Continuously monitor server stats at specified interval.
Function called with stats on each interval
Milliseconds between checks (default: 5000)
Function to stop monitoring
Best-effort fleet-wide cache purge across a multi-child deployment.
A single purgeCache POST is forwarded by the rhino.compute proxy to
just ONE round-robin-selected child, so the other children keep serving
stale cached solves. There is no proxy endpoint that addresses children
individually, so this method reads the active child count (passively, never
spawning) and fires 2 × count sequential purges, relying on the proxy's
round-robin to spread the hits across the pool.
This is best-effort, not a guarantee. Round-robin can revisit one child
and skip another; under concurrent traffic the rotation drifts. The result's
confident flag is true only when the server reports a single child (where
one purge is exact) — surface it so callers don't over-promise. For a hard
fleet-wide guarantee, run the deployment at --childcount 1 or add a
server-side fan-out endpoint.
{ totalPurged, calls, children, confident }, or null if the
child count couldn't be read (server unreachable). totalPurged sums the
per-call counts; calls is how many purges were issued; children is the
reported pool size; confident is true only at a single-child pool.
Purge the server's solve-results / URL-data cache.
POSTs to cache/purge and returns the number of entries removed, or null
if the request failed. This clears cached solve responses and fetched
definition-URL data; it does NOT evict the definition cache (active
pointer references stay valid).
Caveat: cache/purge is forwarded by the rhino.compute proxy to a
single round-robin-selected child, so in a multi-child deployment one call
purges one child's cache. Call repeatedly (or size the pool to 1) if you
need a fleet-wide purge.
Number of entries removed, or null on failure.
Shut down compute children and respawn replacements (rolling restart).
POSTs /recycle-children. With no port it recycles every child; with
port it recycles just that one. The server recycles sequentially (each
replacement is serving before the next child is stopped) so the pool never
drops to zero mid-recycle. Returns { shutdown, spawned, active }, or
null on failure.
Optionalport: numberOptional port to target; omit to recycle all children.
{ shutdown, spawned, active }, or null on failure.
Gracefully shut down compute children without respawning them.
POSTs /shutdown-children. With no port it shuts down every child; with
port it targets just that one. Children do not respawn, but the next
/grasshopper request auto-spawns the pool back to the baseline. Returns
{ shutdown, active } — how many were stopped and the remaining count — or
null on failure.
Optionalport: numberOptional port to target; omit to shut down all children.
{ shutdown, active }, or null on failure.
ComputeServerStats provides methods to query Rhino Compute server statistics.
Use this for server health monitoring and statistics.
Example