ngx_http_geoip2_module
ngx_http_geoip2_module copied to clipboard
high cpu usage on heavy traffic
Hi is there any advice or other when i try to use this module on a high load server nginx starts to consume a lot of cpu is there any caches for the found ip data in the database not to look it up again on the next request from the same ip or any other recommendation to reduce cpu usage. Almost on ddos it is 100% CPU usage with nginx...
I would start with generating a flamegraph of the server when it's not under attack and when it is under attack. That will help with identifying where the CPU increase is and if it is in fact due to geo IP look up.
Right now, there is no caching of geoip information between requests.
Hello @leev,
first thank you for this nice nginx module. We also use it on every our servers for country blocking and in case of ddos attacks. I really have no idea how to program a nginx module but there is a efficient way to improve the performance of this module?
How this module works in detail?
- The geoip database is loaded into RAM on nginx start/reload
- Every nginx request is checked from database on local disk
If 2, maybe it could improve the performance to copy the geoip database into tmpfs directory because of faster RAM?
Because we also can see high cpu load on high traffic servers with active geoip2 module. We also would pay for a nice performance update.