You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/post/hidden-cost-rootless-container-networking/index.adoc
+7-35Lines changed: 7 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,56 +83,28 @@ With --network=host:
83
83
84
84
Every JDBC packet traverses two extra kernel/userspace boundary crossings plus a userspace copy in the pasta process. For a chatty protocol like JDBC with small, frequent packets, this is devastating.
85
85
86
-
=== Bonus: nftables firewall overhead
87
-
88
-
Fedora's `firewalld` maintains 973 https://wiki.nftables.org/[nftables] rules that every packet traverses (`nf_hook_slow` -> `nft_do_chain`). This is independent of pasta — it affects any network traffic on the host. Disabling the firewall recovers another ~10% throughput. This matches findings from https://talawah.io/blog/extreme-http-performance-tuning-one-point-two-million/[prior work on extreme HTTP tuning] where iptables `nf_hook_slow` consumed ~18% of CPU in benchmarks.
86
+
== The fix
89
87
90
-
== Why Quarkus is affected but Spring is not
88
+
Run the PostgreSQL container with `--network=host` instead of port-mapping (`-p 5432:5432`). We added `DB_HOST_NETWORK=true` to the benchmark's https://github.com/quarkusio/spring-quarkus-perf-comparison/blob/main/scripts/infra.sh[infrastructure script].
91
89
92
90
[cols="2,1,1,1", options="header"]
93
91
|===
94
92
| Configuration | Quarkus TPS | Spring TPS | Ratio
Removing pasta boosts Quarkus by 55% but Spring by only 2.3%. **The same absolute overhead hits the efficient framework harder.**
102
-
103
-
Pasta adds ~0.073 ms of kernel CPU per request to Quarkus (the difference between 0.231 and 0.158 ms/req) — that's **46% on top of its framework cost**. Quarkus is CPU-saturated, so every freed cycle translates directly to more requests. Spring spends far more CPU in its own framework code, so saving a small fraction of cycles on networking simply cannot help.
104
-
105
-
**The more CPU-efficient your framework is, the more you feel the infrastructure tax.**
106
-
107
-
== The fix
108
-
109
-
Run the PostgreSQL container with `--network=host` instead of port-mapping (`-p 5432:5432`). We added `DB_HOST_NETWORK=true` to the benchmark's https://github.com/quarkusio/spring-quarkus-perf-comparison/blob/main/scripts/infra.sh[infrastructure script].
100
+
**With host networking, Quarkus throughput improves by 55% while Spring barely moves (+2.3%).** Disabling the firewall on top recovers another 8% for Quarkus, bringing the ratio from 1.19x back to 1.97x — close to the perf-lab's 2.08x.
110
101
111
-
[cols="2,1,1,1", options="header"]
112
-
|===
113
-
| Configuration | Quarkus TPS | vs Perf-lab | Ratio Q/S
**With host networking, the local Fedora workstation matches the perf-lab.** The remaining gap to the perf-lab's 2.08x ratio is accounted for by nftables (Fedora's 973 rules vs RHEL's minimal ruleset) and minor kernel differences.
123
-
124
-
Per-request CPU cost confirms the picture:
102
+
Fedora's `firewalld` maintains 973 https://wiki.nftables.org/[nftables] rules that every packet traverses (`nf_hook_slow` -> `nft_do_chain`). This is independent of pasta — it affects any network traffic on the host. Disabling the firewall recovers another ~10% throughput. This matches findings from https://talawah.io/blog/extreme-http-performance-tuning-one-point-two-million/[prior work on extreme HTTP tuning] where iptables `nf_hook_slow` consumed ~18% of CPU in benchmarks.
125
103
126
-
[cols="2,1", options="header"]
127
-
|===
128
-
| Configuration | CPU ms/req
104
+
== Why Quarkus is affected but Spring is not
129
105
130
-
| Default pasta (15,504 TPS) | 0.231
131
-
| Host networking (24,116 TPS) | 0.158
132
-
| Perf-lab (24,472 TPS) | 0.158
133
-
|===
106
+
Pasta adds ~0.073 ms of kernel CPU per request to Quarkus — that's **46% on top of its framework cost**. Quarkus is CPU-saturated, so every freed cycle translates directly to more requests. Spring spends far more CPU in its own framework code, so saving a small fraction of cycles on networking simply cannot help. **The more CPU-efficient your framework is, the more you feel the infrastructure tax.**
134
107
135
-
With host networking, per-request cost **matches the perf-lab exactly**: 0.158 ms/req.
0 commit comments