Skip to main content
Version: 0.7.x

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 429 with a Retry-After header and increment arkflow_control_plane_rate_limit_rejections_total.

Configuration​

Hub environment variables:

VariableDefaultDescription
ARKFLOW_RATE_LIMIT_ENABLEDtrueMaster switch; false restores unlimited handling.
ARKFLOW_RATE_LIMIT_PRINCIPAL_RPS100Refill per second per operator credential or browser session.
ARKFLOW_RATE_LIMIT_PRINCIPAL_BURST200Burst capacity of a principal bucket.
ARKFLOW_RATE_LIMIT_NODE_RPS500Refill per second per agent node; must cover register/heartbeat/report/commands/observations.
ARKFLOW_RATE_LIMIT_NODE_BURST1000Burst 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:

FieldDefault
enabledtrue
principal_rps100
principal_burst200
node_rps500
node_burst1000

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.

  1. Identify the credential (Authorization principal or node_id). One hot script with a single operator token is the usual cause.
  2. Check whether the limit is principal or node: agent routes use per-node buckets by path prefix.
  3. 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 429 with Retry-After.
  • Confirm agent heartbeats/registrations are not rejected after raising limits.
  • Confirm /metrics and health probes stay unlimited.
  • Confirm placement succeeds for a job whose resources fit 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.