Skip to main content

Overview

Connector resource use depends on your traffic, payload sizes and policies, so no single size fits every deployment. This page explains what drives CPU, memory and disk use, and how to scale and monitor Connectors. It ends with a load-test method to size Connectors for your own workload. For the baseline requirements, see Resource Requirements.

What Drives Resource Use

CPU

The Connector sizes its policy evaluation worker pool to GOMAXPROCS. Go sets GOMAXPROCS from the container CPU limit (Go 1.25 release notes, container-aware GOMAXPROCS). A higher CPU limit gives more parallel policy evaluations. Allocate whole CPU cores. With fractional CPU limits, CPU throttling raises latency and causes timeouts during peaks.

Memory

These factors add to memory use beyond the base process:
  • Log buffer: The Connector buffers up to 400 MB of logs in memory before it spools them to disk.
  • LLM requests: The Connector reads each non-streaming LLM request body whole to evaluate policies on it.
  • HTTP request bodies: The Connector buffers HTTP request bodies up to 1 MB so it can retry them when an upstream closes an HTTP/2 connection.
  • Logged bodies: Each HTTP log keeps at most 500 KB of request and response body, shared between both.
Peak memory scales with concurrency times payload size. For example, 1,000 concurrent LLM requests with 400 KB bodies hold about 400 MB of request bodies alone.

Disk

Disk only holds the log spool, used when logs cannot reach the Control Plane. Size it for your log rate and the outage length you want to cover. See Log Spool.

Default Sizes in Formal Templates

Formal’s deployment templates start from these sizes. They are starting points, not tested capacity limits. Confirm them with a load test.

Scale and High Availability

Run at Least Two Instances

Run at least two instances behind a load balancer, spread across availability zones. A single instance drops every session when it restarts or fails. See Disaster Recovery. Instances that serve the same Connector can form a cluster. Clustering shares state, such as rate limit counters, across instances.

Scale Out on CPU and Memory

The ECS Terraform example and the CloudFormation template use target tracking autoscaling:
  • CPU: Scale to keep average CPU at 60%.
  • Memory: Scale to keep average memory at 70%.
  • Wait time: Wait 300 seconds between scale-in and scale-out steps.
The Connector Helm chart does not create a HorizontalPodAutoscaler. To autoscale on Kubernetes, add one with the chart’s extraManifests value or your own manifests.
Base memory autoscaling on container memory against its limit. Do not use formal.connector.memory.usage_percent; see Metrics to Watch.

Plan for Long-Lived Connections

A load balancer assigns each new TCP connection to one instance. New instances only receive new connections, so scaling out does not move open database sessions or LLM streams. Scale out before peaks, and keep enough headroom for the instances already holding sessions. When an instance stops, it does not wait for open sessions to finish. To drain sessions, see Graceful Shutdown.

Metrics to Watch

Watch these signals during load tests and in production. The Connector does not emit request latency metrics. Measure latency at the client, as described in the load-test method below. formal.connector.memory.usage_percent compares memory in use to memory the Go runtime got from the OS. It ignores the container limit, so values of 70-90% are normal. Do not use it to size memory. To chart these metrics, import the Datadog or Grafana dashboard.

Load-Test a Connector

Load tests show the Connector overhead and the capacity of one instance for your traffic. Run them against a test Connector, never against a Connector that serves production users.

1. Set Up an Isolated Environment

Deploy a dedicated Connector with the same version, size and listeners as production. Use the deployment option you run in production. Run the load generator on a separate host, in the same VPC and availability zone as the Connector. Point the Connector at a mock upstream, so you do not load a real database or pay for LLM tokens. Start with one Connector instance. Per-instance capacity tells you how many instances you need. Verify:

2. Mirror Production Configuration

Apply the same configuration you plan to run in production:
  • Policies: The same policies, since policy complexity drives CPU use.
  • Log configuration: The same log configuration, including body capture and policy evaluation input retention.
  • Identity: A machine user and, if used, a native user with injected credentials.
  • Requests: The same headers, paths and body sizes as real clients.
Send real client headers, because the Connector uses them to detect protocols. For example, the Connector detects Anthropic traffic from the anthropic-version header. Without it, LLM policies do not see the model or messages. Verify: Send one request through the Connector. Open Logs and confirm it shows the expected user, resource and policy results.

3. Measure a Baseline

Run each test twice with the same load: once against the mock upstream directly, and once through the Connector. The difference in latency and errors is the Connector overhead. This k6 script (open source load-testing tool) ramps HTTP traffic against a target URL. It ramps for one minute, then holds each rate for five minutes:
Run it against the mock, then through the Connector:
Enter the machine user secret at the prompt. It stays out of your shell history and process arguments:
Then run the test through the Connector:
k6 reads TARGET_URL and the credentials from environment variables. The credentials are not exported, so later runs against the mock do not send them. Use https:// if the listener has a TLS certificate, and http:// otherwise. Replace the path and body with requests that match your clients. Verify: k6 prints http_req_duration percentiles and the checks pass rate for each run.

4. Ramp Load and Change One Variable at a Time

Increase the request rate in steps, and hold each step for several minutes. The k6 summary combines all steps of a run. To get latency percentiles for one rate, run a test at that rate alone with the constant-arrival-rate executor. Change one variable per run: request rate, body size, streaming, or policy set. This shows which factor limits capacity. Stop raising load at the first of these signs:
  • p99 latency rises well above the baseline
  • Errors or timeouts appear
  • CPU stays near its limit, or CPU throttling appears
  • Memory approaches its limit, or the container restarts
The last step before these signs is the capacity of one instance for that traffic. Verify: Check the metrics for each step, and match them to the latency the load generator reports.

5. Choose Size and Instance Count

Divide your expected peak load by the per-instance capacity. Add headroom for one failed instance or availability zone, and for traffic growth. Deploy at least two instances in production. If memory limits capacity before CPU does, give each instance more memory. If CPU limits capacity, add whole cores or add instances.

6. Clean Up

Each test request produces a log in your Formal organization. Delete the test Connector, its resources and its machine user after the test. Verify: The test Connector no longer appears on the Connectors page.

Troubleshooting

Cause: Concurrent large payloads, many open streams, or a growing log buffer exceed the memory limit. Fix: Raise the memory limit, or run more instances so each holds fewer concurrent requests. Check that logs reach the Control Plane, since undelivered logs stay in memory up to 400 MB.
Cause: The container has a fractional CPU limit and is throttled. Fix: Allocate whole CPU cores, and check throttling metrics from your container runtime.
Cause: Existing clients keep their long-lived connections on the original instances. Fix: Expect new instances to take only new connections. Scale out before peaks.
Cause: The test requests lack the headers or paths that real clients send, so the Connector cannot parse them. Fix: Copy headers such as anthropic-version and the request path from a real client request.
Cause: Logs cannot reach the Control Plane fast enough, so they spool to /formal/logs. Fix: Check Control Plane connectivity, and size the spool volume for your log rate.

Next Steps

Deployment

Infrastructure and network requirements

Health

Collect Connector metrics and logs

Clustering

Share state across instances

Operations

Upgrades, health checks and recovery