Architectural Invariant Design: eBPF TC Egress Packet-Pacing and Network Bufferbloat Prevention
eBPF TC Egress Packet-Pacing and Network Bufferbloat Prevention defines an industrial-grade behavioral standard for devops engineering. Enforces strict kernel-level egress packet pacing (EDT/FQ) and dynamic queue-depth management via eBPF Traffic Control (TC) programs on container virtual ethernet (veth) pairs. Eliminates microburst-induced bufferbloat and noisy-neighbor cross-tenant egress tail latency spikes without relying on coarse host-level HTB or user-space throttling. Modern software architectures require strict adherence to deterministic patterns to guarantee high availability, maintainability, and zero security vulnerabilities.
Hazard Analysis: What Breaks Without This Rule
The following failure modes have been cataloged from hundreds of hours of production code reviews where AI assistants produced non-compliant implementations:
| Failure Mode | AI Symptom (The Anti-Pattern) | Severity | Production Impact & Remedy |
|---|---|---|---|
| AI Hallucination & Deprecation Drift | Unregulated Pod Egress Bursts Inducing Bufferbloat and High p99 Latency via FIFO Queues | Critical | Violating this industrial standard introduces regression bugs, security risks, and unexpected runtime failures in production. Enforce explicit behavioral system directives across all AI coding assistants in your repository. |
| Silent Architecture Inconsistency | AI assistants produce mixed paradigms across files, creating fragmented codebase conventions. | Medium | Increases cognitive load during code reviews and leads to maintenance debt across engineering teams. Pin project conventions in .cursor/rules, CLAUDE.md, and AGENTS.md so all team agents follow identical guardrails. |
Step-by-Step Production Directives
Each rule constraint below is injected into the AI agent's system prompt to establish deterministic boundaries:
Engineers MUST ALWAYS attach eBPF TC programs to the clsact egress hook on container host-facing veth pairs using direct-action mode.
Engineers MUST ALWAYS attach eBPF TC programs to the clsact egress hook on container host-facing veth pairs using direct-action mode.
Engineers MUST ALWAYS leverage Earliest Departure Time (EDT) semantics by calculating and stamping `skb->tstamp` based on tenant token-bucket rate state stored in BPF maps.
Engineers MUST ALWAYS leverage Earliest Departure Time (EDT) semantics by calculating and stamping `skb->tstamp` based on tenant token-bucket rate state stored in BPF maps.
Engineers MUST configure host underlying qdiscs to `fq` (Fair Queueing) or `fq_codel` rather than default `pfifo_fast` or unmanaged `mq` queues to honor `skb->tstamp`.
Engineers MUST configure host underlying qdiscs to `fq` (Fair Queueing) or `fq_codel` rather than default `pfifo_fast` or unmanaged `mq` queues to honor `skb->tstamp`.
Engineers MUST NOT rely on userspace rate limiters, iptables hashlimit, or plain TC police actions that drop packets abruptly instead of pacing via EDT.
Engineers MUST NOT rely on userspace rate limiters, iptables hashlimit, or plain TC police actions that drop packets abruptly instead of pacing via EDT.
Code MUST handle clock skew and wrap-around by using monotonic time (`bpf_ktime_get_ns()`) for all leaky-bucket timestamp calculations.
Code MUST handle clock skew and wrap-around by using monotonic time (`bpf_ktime_get_ns()`) for all leaky-bucket timestamp calculations.
Services MUST monitor TC drop and throttle counters via per-CPU BPF array or perf/ring buffers to provide observability into pod-level egress throttling.
Services MUST monitor TC drop and throttle counters via per-CPU BPF array or perf/ring buffers to provide observability into pod-level egress throttling.
Components NEVER allow unmetered burst traffic exceeding `max_credit` parameters to ensure noisy-neighbor bursts cannot monopolize physical NIC rings.
Components NEVER allow unmetered burst traffic exceeding `max_credit` parameters to ensure noisy-neighbor bursts cannot monopolize physical NIC rings.
Frequently Asked Technical Questions
Common questions developers face when configuring AI coding assistants for this stack:
Q:Why is eBPF TC Egress Packet-Pacing and Network Bufferbloat Prevention critical for AI coding assistants?
Enforces strict kernel-level egress packet pacing (EDT/FQ) and dynamic queue-depth management via eBPF Traffic Control (TC) programs on container virtual ethernet (veth) pairs. Eliminates microburst-induced bufferbloat and noisy-neighbor cross-tenant egress tail latency spikes without relying on coarse host-level HTB or user-space throttling. Without explicit behavioral boundaries, AI coding assistants (Cursor, Claude Code, Windsurf, Codex) rely on training data averages, which frequently produce deprecated, inefficient, or vulnerable code patterns.
Q:How does adopting this rule prevent AI hallucinations?
This rule explicitly declares what the AI must avoid (Unregulated Pod Egress Bursts Inducing Bufferbloat and High p99 Latency via FIFO Queues) and prescribes verified positive examples. Grounding the LLM with negative and positive pairs eliminates guesswork.
Q:Which AI coding environments are supported?
This specification is multi-platform compatible: Cursor (.cursor/rules/*.mdc & .cursorrules), Anthropic Claude Code (CLAUDE.md), Windsurf (.windsurfrules), Codex / Cline (AGENTS.md), and GitHub Copilot (.github/copilot-instructions.md).
Q:Can I combine this rule with other technology stacks?
Yes. Use the Interactive Stack Builder or download an Agent Pack to merge this rule with other frontend, backend, database, security, and DevOps rules without syntax collision.