Bug 1744634
| Summary: | TestOnly: iptables-nft clients are much slower than iptables-legacy clients | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Dan Winship <danw> |
| Component: | iptables | Assignee: | Phil Sutter <psutter> |
| Status: | CLOSED ERRATA | QA Contact: | Tomas Dolezal <todoleza> |
| Severity: | high | Docs Contact: | |
| Priority: | high | ||
| Version: | --- | CC: | dcbw, iptables-maint-list, jean-mickael.guerin, jmaxwell, nakajima.akira, todoleza |
| Target Milestone: | rc | Keywords: | TestOnly |
| Target Release: | 8.2 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | iptables-1.8.4-4.el8 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-04-28 17:00:25 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 1738635, 1755139 | ||
Hi Dan, Thanks for your analysis. The problem is known and I'm currently working on improving the situation. Due to how cache management works in iptables-nft (and nftables), I fear we won't be able to get all use-cases on par with legacy iptables. E.g. deleting a rule from a chain with many rules will always require to fetch at least that chain with all its rules to perform the rule lookup. In theory though, there should be no situation where iptables-nft can't be at least close to legacy iptables performance-wise. Cheers, Phil (In reply to Phil Sutter from comment #1) > I fear we won't be able to get all use-cases on par with legacy > iptables. E.g. deleting a rule from a chain with many rules will always > require to fetch at least that chain with all its rules That would actually be a vast improvement over iptables-legacy, which always requires fetching all of the rules in the entire *table* you are operating on. *** Bug 1707714 has been marked as a duplicate of this bug. *** Hi Dan, I consider this ticket resolved by iptables rebase to 1.8.4 which considerably improved cache handling but would like to have your confirmation first. So could you please give iptables-1.8.4-4.el8 a thorough test regarding performance? Thanks, Phil FTR I hadn't actually done any testing beyond what's in comment 0, but I can retry that (In reply to Dan Winship from comment #6) > FTR I hadn't actually done any testing beyond what's in comment 0, but I can > retry that OK, thanks! Dan, please which command was used to update alternatives and test with iptables-legacy ? There are no iptables-legacy packages in RHEL 8; I was testing on Fedora Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHEA-2020:1889 |
On systems using iptables-nft, the clients are much much slower when there are lots of iptables rules than on systems using iptables-legacy: using legacy: > for i in $(seq 1 30000); do iptables -A INPUT -s 10.1.$(($i / 256).$(($i % 256)) -j DROP; done > time iptables-save > /dev/null real 0m0.038s user 0m0.020s sys 0m0.018s > time iptables -C INPUT -s 1.2.3.4 -j ACCEPT iptables: Bad rule (does a matching rule exist in that chain?) real 0m0.021s user 0m0.006s sys 0m0.015s > time iptables -A INPUT -s 1.2.3.4 -j ACCEPT real 0m0.021s user 0m0.005s sys 0m0.016s > time iptables -t NAT -C PREROUTING -s 1.2.3.4 -j ACCEPT iptables: Bad rule (does a matching rule exist in that chain?) real 0m0.005s user 0m0.002s sys 0m0.003s using nft (after rebooting and updating alternatives) > for i in $(seq 1 30000); do iptables -A INPUT -s 10.1.$(($i / 256).$(($i % 256)) -j DROP; done > time iptables-save > /dev/null real 0m0.470s user 0m0.117s sys 0m0.348s > time iptables -C INPUT -s 1.2.3.4 -j ACCEPT iptables: Bad rule (does a matching rule exist in that chain?) real 0m0.445s user 0m0.102s sys 0m0.340s > time iptables -A INPUT -s 1.2.3.4 -j ACCEPT real 0m0.414s user 0m0.081s sys 0m0.341s > time iptables -t NAT -C PREROUTING -s 1.2.3.4 -j ACCEPT iptables: Bad rule (does a matching rule exist in that chain?) real 0m0.426s user 0m0.081s sys 0m0.341s so, "iptables-save" is 10 times slower, and with iptables-nft, everything seems to take the same amount of time as "iptables-save". (And of particular note: iptables-legacy operations are only slow if the table they are operating on is large, whereas iptables-nft operations appear to be slow if *any* table is large.) iptables 1.8.2 and iptables git master give similar results.