Skip to Content
AgentShield
Self-Hosting

Scaling Considerations

How each AgentShield component scales, where contention appears, and how budgets and per-organization serialization affect throughput.

Component scaling

ComponentModelNotes
GatewayHorizontal, statelessAll shared state is in PostgreSQL and Redis. Scale on CPU and request rate
Intelligence engineHorizontal, statelessCPU-bound regex matching; time grows linearly with content size
Control planeHorizontal, statelessLow traffic relative to the gateway
DashboardHorizontal, statelessServer-side proxy to the control plane
Event relaySingle replicaOrdering is per relay; two relays may interleave events. Claims use SKIP LOCKED, so a second replica would not duplicate work, but ordering guarantees would weaken

The production overlay runs two replicas of each stateless service with disruption budgets.

Where time goes

From the recorded benchmarks, in-memory work per authorization is small:

StepMedian
Ed25519 verification~81 µs
Policy evaluation (5 entries per list)~14 µs
Full in-memory authorization~126 µs

Real latency is dominated by network round trips: Redis (nonce and budget script) and one PostgreSQL transaction for authorize; a claim transaction, the adapter call, and a completion transaction for execute; plus the analyzer call when enabled.

Contention points

Per-organization audit chain. Every event appends to its organization's chain under a row lock on the chain head. Writes for one organization are serialized. This bounds per-organization event throughput and is inherent to a hash chain.

Per-agent budgets. A single agent is limited to 60 requests and 30 calls per tool per minute. Load tests from one agent measure the rate limiter, not the gateway. Throughput scales with the number of agents.

Large policies. Evaluation re-validates both documents on every call: about 565 µs at 200 entries per list. Keep policies focused.

Content analysis. About 4 ms per 16 KiB of content and roughly 130 ms at the 512,000-character request limit. Set INTELLIGENCE_TIMEOUT (≤ 5 s) for your largest results, and add analyzer capacity for throughput. In the Kubernetes production overlay the analyzer is a gateway sidecar, so it scales with gateway replicas. A timeout yields unavailable, not a failure.

Data growth

StoreGrowth driverManagement
PostgreSQLInvocations, decisions, events, chain links per callAppend-only; plan capacity and archival
RedisShort-lived keys per agentSelf-expiring
JetStreamEvents, seven-day retentionSize storage for seven days
Object storageOne bundle per flagged or failed callRetention set by the operator

Availability

  • Run at least two gateway replicas across nodes; the overlay spreads them.
  • PostgreSQL and Redis availability directly bounds gateway availability, because the gateway fails closed without them.
  • The relay and NATS are off the request path. Their outages delay events, not decisions.
  • The analyzer is optional on the request path. Its outage produces unavailable reports.

Was this page helpful?

On this page