โš–๏ธ Load Balancer Ingress Rule Latency

Each ALB rule adds ~1ms of evaluation overhead. 20 rules = 20ms. In a 200ms SLA budget, that is 10% gone before a single line of your application code executes. Input your rule count and evaluation model โ€” first-match linear scan vs. prefix-trie โ€” and quantify the latency tax before it eats your error budget.

๐Ÿ“ Ingress Rule Configuration

Set rule count and evaluation model. First-match linear scan adds ~1ms/rule. Prefix-trie ~0.2ms/rule. Choose your architecture. The engine computes total overhead, percentage of SLA budget consumed, and aggregate tax at scale.

Load Balancer Rule Count and Latency: The Microsecond Tax

Every rule added to a load balancer's ingress configuration imposes a per-request evaluation cost. While individual rule evaluation times are measured in microseconds โ€” typically 40 to 120 nanoseconds per rule depending on the matching algorithm โ€” these costs compound linearly with rule count and accumulate across the request rate. A load balancer processing 10,000 requests per second with 80 active rules under a first-match model can burn approximately 48 milliseconds of CPU time per second purely on rule evaluation, consuming nearly 5% of a single vCPU core before any application logic executes.

How This Calculator Works

ModelPer-Rule CostAvg Overhead FormulaP99 Overhead Formula
First-Match (Linear Scan)0.12 ฮผs per rule(Rules รท 2) ร— 0.12 ฮผsRules ร— 0.12 ฮผs
Prefix-Trie (Tree Search)0.04 ฮผs per rule(Rules รท 2) ร— 0.04 ฮผsRules ร— 0.04 ฮผs

The first-match model (used by AWS ALB listener rules and many simple reverse proxies) evaluates rules sequentially until a match is found. On average, the matching rule sits at the midpoint of the rule list, giving O(n/2) average case and O(n) worst case. The prefix-trie model (used by NGINX with prefix-based location blocks and HAProxy with ACL trees) organizes rules into a radix tree, achieving O(log n) or near-constant evaluation time regardless of rule count โ€” at the cost of more complex configuration semantics when rules have overlapping path patterns.

Minimizing Rule Count in Production

High rule counts typically arise from path-based routing proliferation โ€” one rule per microservice endpoint. Consolidating rules using wildcard prefixes (/api/* instead of /api/users, /api/orders, etc.) and offloading fine-grained routing to a service mesh (Istio, Linkerd) or API gateway dramatically reduces load balancer rule count. A well-architected ingress layer should have fewer than 50 rules; beyond 100 rules, the linear-scan overhead becomes measurable in P99 latency at moderate traffic volumes. For AWS ALB specifically, the hard limit is 100 rules per listener โ€” if you are approaching that, your routing architecture needs refactoring.