Speed up restoring huge rulesets
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest3 patches 3 repliesIn review
Changes since RFC from the cover letter
- Introduce patch 1 to catch the only real issue
- Slight performance drop with nft due to the kept standard target check
- Update commit messages
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | nft: Reject standard targets as chain names when restoringiptables/ iptables/ iptables/ | +4 | 1 reply | |
| 2/3 | libxtables: Implement notargets hash tablelibxtables/ | +75 | 1 reply | |
| 3/3 | libxtables: Boost rule target checks by announcing chain namesinclude/ iptables/ iptables/ +1 more | +11 | 1 reply |
Reviews trailers per patch
All 3 patches have a Reviewed-by or Acked-by.
| Patch | Florian Westphal |
|---|---|
| 1/3 | R-b |
| 2/3 | A-b |
| 3/3 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [iptables PATCH 0/3] Speed up restoring huge rulesets
The largest penalty when restoring a large ruleset is checking for whether a given target name is a chain or extension. Patch 2 adds a cache to libxtables for failed extension lookups so consecutive ones (e.g. multiple rules jumping to the same chain) are fast.
If a ruleset contains many user-defined chains, there is still a significant slow-down due to the single extension lookup which remains. Patch 3 introduces an announcement mechanism, implying that a chain line in a dump file is never a target.
Testing my OCP ruleset (50k chains, 130k rules, 90k chain jumps) again:
variant before after
-------------------------------------
legacy 1m31s 2.6s
nft 1m47s 13s
The performance gain is large enough to justify the lost warning if a chain name clashes with a non-standard target. The only case which was forbidden before, namely a clash with standard target (DROP, ACCEPT, etc.) is still caught due to patch 1 of this series.
Changes since RFC:
- Introduce patch 1 to catch the only real issue
- Slight performance drop with nft due to the kept standard target check
- Update commit messages
Phil Sutter (3):
nft: Reject standard targets as chain names when restoring
libxtables: Implement notargets hash table
libxtables: Boost rule target checks by announcing chain names
include/xtables.h | 3 ++ iptables/iptables-restore.c | 1 + iptables/xshared.c | 4 +- iptables/xshared.h | 2 +- iptables/xtables-restore.c | 6 +-- libxtables/xtables.c | 81 +++++++++++++++++++++++++++++++++++++ 6 files changed, 90 insertions(+), 7 deletions(-)
Signature · 1 line
2.34.1