Systems Tuning
Regex Backtracking CPU Cost vs Native JSON & simdjson Parsing
Benchmark CPU cycles per 10k EPS between Onigmo regex log parsers and structured JSON emitters using Fluent Bit jsmn / simdjson.
JSON Parse: 0.12 vCPU @ 10k EPS vs Regex: 0.78 vCPU (-84% CPU)
Eliminating Regex From Web and API Access Logs
Switching Nginx, Envoy, and Go/Node microservices to emit native single-line JSON lets Fluent Bit parse 25,000 EPS on a single vCPU core instead of burning 2-3 cores on Onigmo regex capture groups.
Writing Safe Regex When Legacy Formats Remain
For legacy Apache or syslog payloads you cannot change, replace greedy .* expressions with explicit negated character classes like [^ ]+ and anchor patterns at ^.
Measured Parameters & Shipper Configuration Directives
| Parser Architecture | CPU @ 10k EPS | Operational Guidance |
|---|---|---|
| Structured JSON (Nginx/App) | ~0.12 vCPU cores | Zero backtracking; fastest path to ClickHouse or Loki |
| Anchored Regex (Single Pass) | ~0.45 vCPU cores | Avoid .* wildcards; anchor with ^ and explicit negated classes |
| Unanchored .* Regex | 0.80 - 1.60+ vCPU cores | Catastrophic backtracking spikes CPU 6-12x on long payloads |
| LTSV / Logfmt Key-Value | ~0.18 vCPU cores | Great compact alternative when full JSON logging is unavailable |