Rate limits and quotas
Both control planes rate-limit requests per credential over the versioned API. The mechanism protects the Hub from credential floods and overload; it is not a business quota system. This runbook explains the knobs, how to recognize rejection, and how job resource requests affect placement capacity.
Use when: traffic grows, a credential is throttled, or you need to size the Hub for a fleet.
How limits work
- Health probes,
/metrics, and the OIDC login flow are exempt. - Token buckets are keyed on a hashed credential: one bucket per operator credential or browser session, one per agent node.
- The bucket table is capacity-bounded; traffic presenting more distinct credentials than the bound shares one slow catch-all bucket, so a forged-credential flood cannot grow memory without limit.
- Over-limit requests receive
429with aRetry-Afterheader and incrementarkflow_control_plane_rate_limit_rejections_total.
Configuration
Hub environment variables:
| Variable | Default | Description |
|---|---|---|
ARKFLOW_RATE_LIMIT_ENABLED | true | Master switch; false restores unlimited handling. |
ARKFLOW_RATE_LIMIT_PRINCIPAL_RPS | 100 | Refill per second per operator credential or browser session. |
ARKFLOW_RATE_LIMIT_PRINCIPAL_BURST | 200 | Burst capacity of a principal bucket. |
ARKFLOW_RATE_LIMIT_NODE_RPS | 500 | Refill per second per agent node; must cover register/heartbeat/report/commands/observations. |
ARKFLOW_RATE_LIMIT_NODE_BURST | 1000 | Burst capacity of a node bucket. |
The standalone (local-plane) node configures the same values under
health_check.rate_limit. The section is flattened into health_check, so the
keys sit beside enabled:
| Field | Default |
|---|---|
enabled | true |
principal_rps | 100 |
principal_burst | 200 |
node_rps | 500 |
node_burst | 1000 |
Defaults sit two orders of magnitude above legitimate traffic, including the default 1 s agent polling cadence. Non-positive or non-finite values fall back to the defaults with a startup warning.
Diagnosing throttling
Symptoms. 429 Too Many Requests, a Retry-After header, dashboards
showing arkflow_control_plane_rate_limit_rejections_total rising, or console
actions that fail only under load.
Diagnosis.
- Identify the credential (
Authorizationprincipal ornode_id). One hot script with a single operator token is the usual cause. - Check whether the limit is principal or node: agent routes use per-node buckets by path prefix.
- Compare the request cadence with the configured RPS/burst. A burst that empties the bucket at startup is normal; sustained rejection is not.
Fix. Give automation its own credential, smooth polling with jitter, or raise the limit for the specific principal/node after measuring. Raising the node RPS without addressing a hot loop only delays the next rejection.
Job resources and placement capacity
Rate limits are request-level. Separately, a Job can declare per-task
resources requests (cpu_millicores, memory_bytes) that participate in
placement accounting. The Hub ranks eligible nodes by headroom (freshest gauges,
most available memory, then CPU, then node id) and subtracts placed requests.
This is placement capacity, not a hard cgroup quota: it decides where a task
may land, and a node that has not reported gauges ranks last.
Size the fleet so that the sum of placed requests fits the nodes you reserve for
compute, and leave headroom for re-placement after a node failure. A job pinned
with node_ids bypasses ranking; rebalance: auto can relocate it but cannot
combine with a pinned set.
Verification
- Send a known burst with a test credential and confirm the first N requests
succeed, then
429withRetry-After. - Confirm agent heartbeats/registrations are not rejected after raising limits.
- Confirm
/metricsand health probes stay unlimited. - Confirm placement succeeds for a job whose
resourcesfit the target nodes.
Rollback
Set ARKFLOW_RATE_LIMIT_ENABLED=false (or health_check.rate_limit.enabled: false) and restart the process to restore unlimited handling immediately. This
is a safe rollback for a throttling incident but removes the flood protection;
restore a measured limit as soon as the hot client is fixed.