A Linux firewall may use very little CPU when a server exchanges large amounts of data over a few long-lived connections, then behave differently under ordinary workloads that open and close many connections. The difference can come from the state machinery behind firewall rules.
Connection tracking, or conntrack, allows policies to reason about network conversations rather than isolated packets. That functionality is valuable. It is not free.
What connection tracking buys
The nftables connection tracking documentation describes how Netfilter tracks connections so a firewall can distinguish packets associated with existing conversations from other traffic. Stateful network address translation relies on related machinery.
This lets administrators express policies that would be difficult to reproduce using only packet headers. For example, an established session can be handled differently from a new attempt to reach a service. In NAT deployments, state also allows replies to be translated consistently.
The cost is a flow lifecycle that extends beyond an individual packet.
Not every packet costs the same
An existing conversation generally needs to be associated with its tracking entry. A previously unseen conversation may require additional validation and state creation. Expiration and removal add more work. The details depend on protocol, kernel version, policy and enabled features.
A host that maintains many active entries needs memory for those entries and their lookup structures. Access patterns influence cache locality. Concurrent updates and housekeeping can affect CPU consumption. It is therefore misleading to describe all conntrack traffic using one universal per-packet cost.
The Linux kernel's conntrack sysctl reference distinguishes current allocated entries, hash buckets, maximum entries and protocol-dependent timeout settings. These are different quantities. The correct interpretation also depends on the running kernel and network namespace.
Size is only one dimension of pressure
A table can be comfortably below its entry limit while the host spends substantial time managing state. Conversely, a large table of mostly inactive or stable flows might consume memory without creating proportionally high CPU activity.
An operator should distinguish occupancy from churn, and relate both to CPU and application telemetry. Measure allocation failures, state lifecycle rates, loss, latency and successful application connections where the platform exposes reliable counters. Avoid extrapolating a memory-per-entry estimate from a different kernel or configuration.
A larger maximum can provide room for legitimate concurrency, but it does not reduce the work required to manage each entry. Extending timeouts also changes resource retention and must be evaluated against application semantics.
Filtering earlier without losing correctness
Native XDP can run before much of the conventional receive stack, as described by the XDP research project. That makes it useful for rejecting traffic that can be identified safely without downstream state. It does not make all state unnecessary.
The Ubuntu nftables documentation explains the integration of firewall hooks, connection tracking and NAT. Bypassing tracking for traffic that depends on these features can break functionality or change security behavior. Asymmetric paths and application protocols add further constraints.
The appropriate boundary is architectural: perform safe, independently verifiable decisions early while retaining the state required by the services that need it. Avoid a blanket change that improves a synthetic benchmark by silently removing policy semantics.
Benchmark the service and its policy
Compare configurations under equivalent firewall behavior and representative connection lifecycles. Include stable traffic, connection creation and expiration, normal concurrency and recovery behavior. Record memory, CPU, loss and application success. Keep forwarding performance and state-management performance distinct.
This matters because the apparent savings from deleting state can be outweighed by broken connectivity or security. A useful optimization preserves the required firewall and NAT behavior while reducing unnecessary work. The objective is predictable service delivery, not the smallest possible conntrack counter.

