This episode tunes OpenClaw performance for production scale: sizing the control plane and data plane, optimizing policy evaluation for fast decisions, plus horizontal scaling and high availability configuration that withstands failures.

In episode 14 you learned to read OpenClaw during incidents — flow logs, audit logs, and correlation with traces. But there's one type of incident that's the most dangerous because it's masked as normal performance: when OpenClaw itself becomes the slow point. A policy evaluated slowly means every request is slow too, and an overwhelmed control plane means the whole cluster loses its director.
Episode 15 focuses on the engine: sizing the control plane and data plane, optimizing policy evaluation, and horizontal scaling and high availability. The goal is simple — policy decisions must come as fast and as reliably as possible.
OpenClaw has two parts with different loads. The control plane manages policies, certificates, and state synchronization; its workload grows with the number of namespaces, policies, and registered services, not with request volume. The data plane — an agent on every node or a sidecar — evaluates policies per request; its workload grows with traffic throughput and rule complexity.
This has an important consequence: adding thousands of requests per second doesn't burden the control plane, but burdens the data plane. Conversely, adding hundreds of policies without any requests still loads the control plane because it must distribute state. Correct sizing starts from understanding this division, not guessing from the cluster's total CPU.
The most honest way to size is to measure, not guess. Use the exposure metrics you saw in episode 14:
openclaw metrics control-plane --window 24h
openclaw metrics data-plane --window 24h
openclaw bench policy --workload checkout-flowopenclaw bench policy loads a workload simulation with realistic patterns and returns p50/p99 evaluation latency — the most valuable numbers for determining replica size. A practical rule of thumb as a starting point: for the control plane, give 512MB to 1GB of memory per 200 policies with leader election active; for the data plane, about 50ms of CPU per thousands of requests per second depending on rule complexity. After that, let your own cluster's baseline speak.
Also make sure containers agree to resource limits consistent with the profile, so the scheduler doesn't place excessive replicas on small nodes:
resources:
requests:
cpu: 500m
memory: 512Mi
limits:
cpu: "1"
memory: 1GiPolicy evaluation latency is a cost paid per request, so small wins here multiply. Four techniques with the most impact:
Indexing: make sure policies use unique label selectors distributed as an index, not linear per-rule evaluation. A rule indexable with app=web-store is far faster than a rule that inspects the request body every time.
Rule ordering: put the most frequently matching rules at the top. OpenClaw stops evaluating once a decision is certain (short-circuit), so the first matching rule saves all subsequent evaluation.
Avoid heavy regex: complex regex patterns in layer 7 rules are latency killers. Replace them with prefix matching or simpler matchers where possible.
Decision caching: decisions for the same source-destination combination rarely change within seconds. Enable caching with a short TTL:
apiVersion: openclaw.io/v1
kind: PerformanceConfig
metadata:
name: tuned
namespace: openclaw-system
spec:
decisionCache:
enabled: true
ttlSeconds: 5
maxEntries: 10000
ruleOrder: frequency
indexing: autoBeware of too-long cache TTL: a decision cached too long can delay new policies taking effect. A 3-5 second TTL balances speed and freshness.
The data plane follows the cluster's node count — every node has an agent that can be replicated according to load. The control plane, as a stateful component, needs a high availability pattern: active replicas with leader election. Only one leader writes; the rest are standby and ready to take over when the leader fails.
Scaling and HA configuration:
apiVersion: openclaw.io/v1
kind: ControlPlaneConfig
metadata:
name: ha-prod
namespace: openclaw-system
spec:
replicas: 3
leaderElection:
enabled: true
leaseDurationSeconds: 15
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app: openclaw-control-plane
topologyKey: topology.kubernetes.io/zonepodAntiAffinity forces the three replicas to spread across three different zones — one zone goes down, the other two keep serving. For fluctuating loads, combine this with an autoscaler based on evaluation metrics:
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: openclaw-control-plane
namespace: openclaw-system
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: openclaw-control-plane
minReplicas: 3
maxReplicas: 6
metrics:
- type: Pods
pods:
metric:
name: openclaw_policy_eval_latency_ms
target:
type: AverageValue
averageValue: 5Finally, protect critical components with a PodDisruptionBudget so node maintenance doesn't stop all replicas at once:
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: openclaw-control-plane
namespace: openclaw-system
spec:
minAvailable: 2
selector:
matchLabels:
app: openclaw-control-planeInfo
High availability isn't just about replicas. Test failover regularly: force-kill the leader in staging, measure how many seconds until its replacement takes over, and make sure no policy is lost in the process. HA that was never tested is just unproven configuration.
Episode 15 gave OpenClaw an engine worthy of production: sizing based on measurement, not guesses; policy evaluation optimization through indexing, rule ordering, and caching; and high availability with leader election, cross-zone anti-affinity, and disruption budgets. OpenClaw is now fast to answer and tough to knock down.
Key takeaways:
openclaw bench policy before deciding replica size.The engine is fast, but sometimes unique needs aren't covered by built-in features. In episode 16 we open the box: Custom Extensions & Plugins — custom policy modules, external data source integration, and advanced rule evaluation hooks. See you there!