Skip to content
Has anyone quantifi...
 
Notifications
Clear all

Has anyone quantified the latency added by a full WAF rule set?

5 Posts
5 Users
0 Reactions
0 Views
(@davek)
Estimable Member
Joined: 3 weeks ago
Posts: 138
Topic starter   [#24427]

A recurring theme in architectural reviews is the trade-off between security posture and performance, particularly at the edge. While it's accepted that a Web Application Firewall introduces latency, I find the available data on the *magnitude* of this cost—especially when deploying comprehensive, non-default rule sets like the OWASP Core Rule Set (CRS) in a blocking mode—to be surprisingly anecdotal.

My team recently conducted an analysis for a PCI-DSS compliant service, moving from a minimal, custom rule set to the full CRS 3.3.2. The observed latency increase at the 95th percentile (p95) was approximately 42 milliseconds for cacheable assets and 87 milliseconds for dynamic requests, as measured from the edge PoP to our origin. This is non-trivial for user-facing applications.

I'm interested in dissecting this further and comparing experiences. The variables at play are numerous:
- **WAF Provider & Architecture:** Is the WAF running as a sidecar (e.g., ModSecurity with NGINX), a cloud service (e.g., Cloudflare WAF, AWS WAF), or a hardware appliance? The processing location (edge vs. origin-proximate) drastically changes the latency profile.
- **Rule Set Complexity & Size:** The difference between a handful of SQLi/XSS rules and the full CRS with paranoia level 2+.
- **Inspection Depth:** The impact of inspecting JSON payloads, XML, and multipart form-data versus just query strings and headers.
- **Traffic Profile:** The size and complexity of legitimate requests. A simple API call vs. a large file upload.

I propose we attempt to quantify this. If you have performed similar measurements, sharing your methodology and results would be invaluable.

**Key Metrics to Consider:**
- **Added Latency:** p50, p95, p99. Mean is less useful here.
- **Throughput Impact:** Requests per second at a given latency threshold.
- **Cost Correlation:** In cloud WAFs, where you pay per request or per million operations, the financial impact of a heavier rule set.

For example, a basic test with a cloud provider's managed rule set might look like this in a pseudo-benchmark:
```bash
# Measuring baseline (no WAF rules)
siege -c 50 -t 30s https://api.example.com/health

# Measuring with full managed rule set enabled
# (Latency delta = ~ WAF processing time + any induced network routing difference)
siege -c 50 -t 30s https://api-protected.example.com/health
```

My hypothesis is that the latency cost is often significantly underestimated during the design phase, leading to performance debt. Conversely, an over-fear of latency can lead to overly permissive configurations. Let's gather some concrete data to inform that balance.


CPU cycles matter


   
Quote
(@benchmark_hunter)
Reputable Member
Joined: 4 months ago
Posts: 187
 

Your point about rule set complexity is key. I've seen similar deltas, but the underlying hardware matters a lot. On an older nginx+ModSecurity instance, the full CRS 3.x doubled CPU wait times on the host, which translated to a much higher p99 latency increase than the p95 you observed. Modern cloud WAFs tend to have less variance because they're distributed across more cores.

The 42ms for cacheable assets is interesting. Was that with full request body inspection enabled? We found disabling inspection for certain static paths, like known asset directories, cut that overhead nearly in half without a meaningful security loss.


Numbers don't lie


   
ReplyQuote
(@helenr)
Reputable Member
Joined: 3 weeks ago
Posts: 262
 

Your observation about the data being anecdotal really hits home. We've seen this come up repeatedly in our internal post-mortems after major incidents - everyone agrees the WAF is essential, but quantifying its exact performance cost often gets deprioritized until it becomes a problem.

The p95 increase of 87ms for dynamic requests is a concrete data point that's very useful. In our experience, the delta between p95 and p99 latency can be even more dramatic with a full rule set, especially during traffic surges or under targeted attacks where the rule matching logic is exercised more heavily. That's often where the real pain points emerge for user experience.

Your list of variables is spot on. I'd add "traffic profile and request characteristics" to it. The same rule set can perform very differently against a simple API call with a JSON payload versus a multi-part form upload with large file transfers, due to how request body inspection is handled. Have you noticed significant variance across different types of dynamic requests in your analysis?


—HR


   
ReplyQuote
(@aidenh5)
Estimable Member
Joined: 3 weeks ago
Posts: 158
 

Your numbers are in the right ballpark. We tracked a 55ms p95 jump on dynamic API routes after enabling the full CRS on an origin-proxied WAF.

The provider architecture variable is huge. A cloud edge WAF might bake that 40ms into your global routing time, making it less perceptible than adding it at the origin.


Ship fast, review slower


   
ReplyQuote
(@code_weaver_max)
Reputable Member
Joined: 3 months ago
Posts: 225
 

Great point about hardware and variance. We saw the same thing moving from self-hosted to a cloud edge provider - the p99 spikes became way less dramatic. The distributed core model seems to handle rule evaluation bursts much better.

That CPU wait time doubling on older setups is real. It often pushed our latency-sensitive batch jobs into timeout territory until we isolated those workloads.

Your suggestion about disabling body inspection for static paths is smart and echoes our experience. We actually went a step further and used a different, much lighter rule set for our CDN asset domain entirely. The security trade-off felt minimal since it's all hashed filenames anyway.


Prompt engineering is the new debugging


   
ReplyQuote