Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: aojea The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
fcd74dc to
93119c2
Compare
5dd8893 to
f66b4f6
Compare
In general if you are listing large numbers of rules, you're probably doing something wrong anyway, in terms of good nftables architecture. (kube-proxy never calls We could optimize the This would be less memory-efficient than the current system in the case where someone lists a lot of rules and then keeps a handle to just one of them, but again, "probably doing something wrong anyway". (Despite what the comment says, neither the old nor the new code sets |
87ac32d to
45d427b
Compare
41f4670 to
94c2b8e
Compare
Implement List() method using netlink directly to avoid the overhead of calling the nft user space progam and parsing its output. Also, reducing the exposure to bugs or problems caused by skew versions of the binary when running inside containers. benchmark netlink vs nft /hack/benchmark.sh Running benchmarks in a new network namespace... goos: linux goarch: amd64 pkg: sigs.k8s.io/knftables cpu: Intel(R) Xeon(R) CPU @ 2.60GHz BenchmarkListChains_NFT_10 BenchmarkListChains_NFT_10-48 435 2727261 ns/op 72902 B/op 369 allocs/op BenchmarkListChains_NFT_100 BenchmarkListChains_NFT_100-48 252 4751280 ns/op 238012 B/op 2545 allocs/op BenchmarkListChains_NFT_1000 BenchmarkListChains_NFT_1000-48 45 26322812 ns/op 1771818 B/op 24162 allocs/op BenchmarkListChains_NFT_10000 BenchmarkListChains_NFT_10000-48 5 249445099 ns/op 16737220 B/op 240197 allocs/op BenchmarkListChains_Netlink_10 BenchmarkListChains_Netlink_10-48 6103 180090 ns/op 24133 B/op 188 allocs/op :x BenchmarkListChains_Netlink_100-48 2169 526953 ns/op 88200 B/op 1062 allocs/op BenchmarkListChains_Netlink_1000 BenchmarkListChains_Netlink_1000-48 312 3816398 ns/op 766180 B/op 9731 allocs/op BenchmarkListChains_Netlink_10000 BenchmarkListChains_Netlink_10000-48 18 63964912 ns/op 8220568 B/op 96582 allocs/op PASS" * Speed: 4x to 15x faster - 10 chains: ~0.18ms vs ~2.72ms (15x faster) - 10k chains: ~63.9ms vs ~249.4ms (4x faster) * Memory: ~50% to ~66% less memory used per operation - 10 chains: ~24KB vs ~72KB - 10k chains: ~8.2MB vs ~16.7MB * Garbage Collection: ~50% to ~60% reduction in object allocations - 10k chains: ~96.5k allocs vs ~240k allocs
|
@danwinship what do we want to do with this? do we wait? |
|
I think we should backport the |
|
I see you already tagged itv0.0.21 with the terse fix |
Implement List() method using netlink directly to avoid the overhead of
calling the nft user space progam and parsing its output. Also, reducing
the exposure to bugs or problems caused by skew versions of the binary
when running inside containers.