Architectural Invariant Design: eBPF TC Egress Packet Scheduling & Multi-Tenant Bandwidth Isolation
eBPF TC Egress Packet Scheduling & Multi-Tenant Bandwidth Isolation defines an industrial-grade behavioral standard for devops engineering. Enforces deterministic kernel-space egress traffic shaping and tenant rate limiting via eBPF Traffic Control (TC) BPF_PROG_TYPE_SCHED_ACT programs. Prevents noisy-neighbor egress bandwidth starvation on multi-tenant Kubernetes nodes by binding Token Bucket Filter (TBF) and Earliest Departure Time (EDT) scheduling algorithms directly to virtual ethernet and physical root interfaces. 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 | Relying on Userspace Rate Limiters or Best-Effort CNI QoS Without Kernel-Level TC Egress Queue Enforcement | 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 egress shapers to the TC subsystem via BPF_TC_EGRESS hooks on host interfaces and container veth pairs using direct-action mode (da).
Engineers MUST ALWAYS attach eBPF egress shapers to the TC subsystem via BPF_TC_EGRESS hooks on host interfaces and container veth pairs using direct-action mode (da).
Engineers MUST ALWAYS compute delivery deadlines using skb->tstamp via Earliest Departure Time (EDT) coupled with FQ (Fair Queueing) qdisc rather than spinning or sleeping inside kernel programs.
Engineers MUST ALWAYS compute delivery deadlines using skb->tstamp via Earliest Departure Time (EDT) coupled with FQ (Fair Queueing) qdisc rather than spinning or sleeping inside kernel programs.
Engineers MUST ALWAYS use atomic BPF map lookups (BPF_MAP_TYPE_HASH or BPF_MAP_TYPE_LRU_HASH) with __sync_fetch_and_add for token replenishment to eliminate race conditions across concurrent CPU cores.
Engineers MUST ALWAYS use atomic BPF map lookups (BPF_MAP_TYPE_HASH or BPF_MAP_TYPE_LRU_HASH) with __sync_fetch_and_add for token replenishment to eliminate race conditions across concurrent CPU cores.
Engineers MUST NOT rely on userspace traffic proxying, iptables string-matching, or cgroupv1 blkio/net_cls controllers for network egress rate isolation.
Engineers MUST NOT rely on userspace traffic proxying, iptables string-matching, or cgroupv1 blkio/net_cls controllers for network egress rate isolation.
Code SHOULD return TC_ACT_SHOT on token exhaustion or quota breach and emit a perf event / ring buffer metric to register throttled packets immediately.
Code SHOULD return TC_ACT_SHOT on token exhaustion or quota breach and emit a perf event / ring buffer metric to register throttled packets immediately.
Services MUST pin BPF rate-limit maps under /sys/fs/bpf to guarantee state persistence during CNI daemon agent restarts and upgrades.
Services MUST pin BPF rate-limit maps under /sys/fs/bpf to guarantee state persistence during CNI daemon agent restarts and upgrades.
Components NEVER drop control plane traffic (ARP, ICMP, DHCP, DNS, and internal health checks) regardless of tenant egress saturation.
Components NEVER drop control plane traffic (ARP, ICMP, DHCP, DNS, and internal health checks) regardless of tenant egress saturation.
Frequently Asked Technical Questions
Common questions developers face when configuring AI coding assistants for this stack:
Q:Why is eBPF TC Egress Packet Scheduling & Multi-Tenant Bandwidth Isolation critical for AI coding assistants?
Enforces deterministic kernel-space egress traffic shaping and tenant rate limiting via eBPF Traffic Control (TC) BPF_PROG_TYPE_SCHED_ACT programs. Prevents noisy-neighbor egress bandwidth starvation on multi-tenant Kubernetes nodes by binding Token Bucket Filter (TBF) and Earliest Departure Time (EDT) scheduling algorithms directly to virtual ethernet and physical root interfaces. 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 (Relying on Userspace Rate Limiters or Best-Effort CNI QoS Without Kernel-Level TC Egress Queue Enforcement) 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.