Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbip performance improvements #27

Merged
merged 4 commits into from
May 3, 2022
Merged

dbip performance improvements #27

merged 4 commits into from
May 3, 2022

Conversation

chr0mag
Copy link
Owner

@chr0mag chr0mag commented May 2, 2022

When only the nftables firewall type is selected, geoipsets will avoid converting dbip data to CIDR notation and simply pass the IP ranges directly to nftables without modification. This results in a ~50% performance improvement.

# before
[tags/v2.3.2] % time python -m geoipsets --provider dbip --firewall nftables --config-file ~/geoipsets.conf
Building geoipsets...
python -m geoipsets --provider dbip --firewall nftables --config-file   11.66s user 0.07s system 94% cpu 12.387 total

# after
[dbip-perf] % time python -m geoipsets --provider dbip --firewall nftables --config-file ~/geoipsets.conf
Building geoipsets...
python -m geoipsets --provider dbip --firewall nftables --config-file   5.07s user 0.07s system 88% cpu 5.789 total

Fixes #25

Also includes a small change to only delete existing sets if the current run will re-create them. Otherwise they are left untouched. This brings the behaviour of the dbip provider inline with the MaxMind provider.

@chr0mag chr0mag merged commit e0488a3 into main May 3, 2022
@chr0mag chr0mag deleted the dbip-perf branch May 3, 2022 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[dbip] Performance improvement
1 participant