Performance Tuning

Goals

  • Keep decision path latency low and predictable
  • Avoid shared-dict pressure and hot-key contention

Key levers

1) Shared dict sizing

FAIRVISOR_SHARED_DICT_SIZE controls in-memory limiter state capacity.

  • Start at 128m
  • Increase to 256m/512m for high cardinality keys
  • Monitor for eviction-like behavior and unexpected limiter resets

2) Descriptor cardinality

Avoid unbounded key dimensions in limit_keys.

  • Prefer stable IDs (jwt:org_id, header:x-api-key)
  • Avoid raw per-request unique values as keys

3) Gateway timeout budget

Keep gateway->edge auth timeout tight (typical 200-500ms budget) and observe p99.

4) Worker and runtime tuning

  • FAIRVISOR_WORKER_PROCESSES=auto usually works well
  • Increase only after measuring CPU saturation and queueing

Practical baseline

  • FAIRVISOR_SHARED_DICT_SIZE=128m
  • deterministic retry jitter enabled by default
  • short gateway timeout and clear fail-open/fail-closed policy

Validate after changes

  • Reject/allow mix remains stable
  • No spike in decision latency metrics
  • No abnormal descriptor-missing metrics