Nginx with big geo maps affects whole system performance on reload
SannisDev
nginx-forum at forum.nginx.org
Tue Aug 3 17:00:50 UTC 2021
Thanks for your quick answer!
>> I'm running Nginx 1.20.1 on CentOS 8.4.2105 with a quite large geo maps,
>> including country/isp/connection for both IPv4 and IPv6, with raw size
about
>> 80Mb.
>> Hardware is: 2x Intel(R) Xeon(R) Silver 4116 CPU @ 2.10GHz, 64Gb RAM
>>
>> On nginx testconf or reload I'm experiencing increase of running nginx
>> latency, 99th percentile growth from 10ms to seconds.
[...]
> Loading large geo map can be quite expensive, that's expected:
> nginx has to parse all the records provided in text and build
> corresponding radix tree. Make sure you have enough spare CPU and
> free memory to actually do the work without affecting other tasks
> on the server. In particular, in my practice it is a good idea to
> make sure the number of nginx worker processes is less than number
> of available cores, or you'll risk getting high latencies when
> doing CPU-intensive tasks like parsing geo maps or compressing
> logs.
I followed this path but did not reach the end.
Currently I set workers processes twice less than physical cores number,
but this does not affect situation. Next step should be start nginx under
taskset
and set workers affinity to other cores but this sounds hacky for me.
> Also it might be a good idea to switch to using ranges and a
> separate include file, so nginx will be able to cache parsing
> results in a binary file.
According to [1] ranges does not support IPv6 for now.
Is there a chance to request this via feature request?
[1]:
https://github.com/nginx/nginx/blob/master/src/http/modules/ngx_http_geo_module.c#L732
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,292129,292140#msg-292140
More information about the nginx
mailing list