Re: nginx есть десятки гигабат памяти и сервер уходит в swap

Илья Шипицин chipitsine на gmail.com
Пн Янв 10 14:48:47 UTC 2022


reload делаете ? количество процессов-воркеров мониторите ?

пн, 10 янв. 2022 г. в 17:41, Дугин Сергей <drug на qwarta.ru>:

> Здравствуйте, Nginx-ru.
>
> Помогите nginx в течении часа после запуска начинает жрать порядка 60-70
> гигобайт памяти и дальше растет
> не хвтает свапа и сервер перегружать приходится если вовремя не килнуть и
> не перезапустить nginx
> Скриншот прилагаю.
> Была более старая версия, таже была проблема.
>
> В логе  ошибок
> error_log  /var/log/nginx/error.log warn;
> Ошибок нет
>
> Меня смущает только такие параметры в nginx:
>     server_names_hash_max_size 131070;
>     server_names_hash_bucket_size 128;
>
> Но если делать меньше nginx не запускается, так как порядка 2000 доменов в
> конфиге прописано. Подбирал эти числа на практике.
> Но даже с ними не понятно почему пару процессов nginx отжирают по 30 гиг
> RAM
>
> Больше идей нет, есть у кого-нибудь мысли как можно починить ситуацию?
>
> nginx version: nginx/1.20.2
>
> built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
> built with OpenSSL 1.0.2k-fips  26 Jan 2017
> TLS SNI support enabled
> configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx
> --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf
> --error-log-path=/var/log/nginx/error.log
> --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid
> --lock-path=/var/run/nginx.lock
> --http-client-body-temp-path=/var/cache/nginx/client_temp
> --http-proxy-temp-path=/var/cache/nginx/proxy_temp
> --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
> --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
> --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx
> --with-compat --with-file-aio --with-threads --with-http_addition_module
> --with-http_auth_request_module --with-http_dav_module
> --with-http_flv_module --with-http_gunzip_module
> --with-http_gzip_static_module --with-http_mp4_module
> --with-http_random_index_module --with-http_realip_module
> --with-http_secure_link_module --with-http_slice_module
> --with-http_ssl_module --with-http_stub_status_module
> --with-http_sub_module --with-http_v2_module --with-mail
> --with-mail_ssl_module --with-stream --with-stream_realip_module
> --with-stream_ssl_module --with-stream_ssl_preread_module
> --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
> -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches
> -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'
>
>  cat /etc/os-release
> NAME="CloudLinux"
> VERSION="7.9 (Boris Yegorov)"
> ID="cloudlinux"
>
> Linux 3.10.0-962.3.2.lve1.5.42.el7.x86_64 #1 SMP Mon Nov 9 08:11:18 EST
> 2020 x86_64 x86_64 x86_64 GNU/Linux
>
>
> top - 17:33:50 up 12:18,  1 user,  load average: 13.88, 13.09, 12.50
> Tasks: 909 total,   7 running, 901 sleeping,   0 stopped,   1 zombie
> %Cpu(s): 12.1 us,  4.8 sy,  0.1 ni, 82.2 id,  0.3 wa,  0.0 hi,  0.6 si,
> 0.0 st
> KiB Mem : 13182188+total,  4598376 free, 75250656 used, 51972864 buff/cache
> KiB Swap: 10077298+total, 96888000 free,  3884988 used. 44158760 avail Mem
>
>   PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
> 12785 root      20   0   35.0g  34.0g   2440 S  28.0 27.1  10:43.40 nginx
> 12807 root      20   0   14.4g  13.4g   2448 S  29.6 10.6   4:22.15 nginx
> 12805 root      20   0 2904776   1.8g   2588 S   3.0  1.4   1:10.02 nginx
> 12802 root      20   0 2880556   1.8g   2432 S   2.0  1.4   0:52.17 nginx
> 12799 root      20   0 2859616   1.8g   2452 S   1.6  1.4   0:31.47 nginx
> 12795 root      20   0 2844724   1.7g   2436 S   1.0  1.4   0:23.12 nginx
> 12793 root      20   0 2838340   1.7g   2548 S   0.3  1.4   0:19.55 nginx
> 12791 root      20   0 2831640   1.7g   2432 S   0.7  1.4   0:17.34 nginx
> 12779 root      20   0 2823876   1.7g   2404 S   0.3  1.4   0:12.40 nginx
> 12778 root      20   0 2821256   1.7g   2352 S   0.0  1.4   0:10.86 nginx
> 12777 root      20   0 2819208   1.7g   2392 S   0.7  1.4   0:09.13 nginx
> 12774 root      20   0 2816544   1.7g   2364 S   0.3  1.4   0:08.00 nginx
> 12771 root      20   0 2815748   1.7g   2392 S   0.7  1.4   0:07.82 nginx
> 12767 root      20   0 2813880   1.7g   2324 S   0.3  1.4   0:06.81 nginx
> 12763 root      20   0 2813828   1.7g   2348 S   0.0  1.4   0:06.76 nginx
> 12761 root      20   0 2813480   1.7g   2360 S   0.7  1.4   0:06.26 nginx
> 12760 root      20   0 2812952   1.7g   2376 S   0.0  1.4   0:05.89 nginx
> 12757 root      20   0 2812084   1.7g   2364 S   0.0  1.4   0:05.78 nginx
> 12707 root      20   0 2811584   1.7g   2304 S   0.3  1.4   0:02.55 nginx
> 12759 root      20   0 2811772   1.7g   2312 S   0.3  1.4   0:05.61 nginx
> 12694 root      20   0 2811380   1.7g   2288 S   0.3  1.4   0:02.06 nginx
> 12711 root      20   0 2811416   1.7g   2300 S   0.0  1.4   0:02.54 nginx
> 12686 root      20   0 2811228   1.7g   2288 S   0.0  1.4   0:01.14 nginx
> 12710 root      20   0 2811108   1.7g   2288 S   0.0  1.4   0:02.52 nginx
> 12752 root      20   0 2811060   1.7g   2316 S   0.3  1.4   0:04.99 nginx
> 12748 root      20   0 2811024   1.7g   2296 S   0.3  1.4   0:05.05 nginx
> 12745 root      20   0 2811144   1.7g   2288 S   0.3  1.4   0:04.58 nginx
> 12699 root      20   0 2811012   1.7g   2280 S   0.0  1.4   0:02.20 nginx
> 12728 root      20   0 2811028   1.7g   2276 S   0.0  1.4   0:03.09 nginx
> 12690 root      20   0 2811196   1.7g   2280 S   0.3  1.4   0:01.93 nginx
> 12754 root      20   0 2810868   1.7g   2272 S   0.0  1.4   0:04.98 nginx
> 12688 root      20   0 2810928   1.7g   2312 S   0.0  1.4   0:01.72 nginx
> 12732 root      20   0 2810948   1.7g   2276 S   0.0  1.4   0:03.34 nginx
> 12687 root      20   0 2810944   1.7g   2284 S   0.0  1.4   0:01.50 nginx
> 12703 root      20   0 2810852   1.7g   2292 S   0.3  1.4   0:02.23 nginx
> 12739 root      20   0 2810884   1.7g   2280 S   0.0  1.4   0:04.25 nginx
> 12738 root      20   0 2810916   1.7g   2296 S   0.3  1.4   0:04.03 nginx
> 12717 root      20   0 2810788   1.7g   2316 S   0.0  1.4   0:02.82 nginx
> 12742 root      20   0 2810768   1.7g   2276 S   0.0  1.4   0:04.38 nginx
> 12684 root      20   0 2810760   1.7g   2296 S   0.0  1.4   0:01.01 nginx
> 12682 root      20   0 2810676   1.7g   2280 S   0.0  1.4   0:00.88 nginx
> 12715 root      20   0 2810624   1.7g   2280 S   0.0  1.4   0:02.72 nginx
> 12734 root      20   0 2810600   1.7g   2280 S   0.0  1.4   0:03.49 nginx
> 12736 root      20   0 2810504   1.7g   2284 S   0.0  1.4   0:03.65 nginx
> 12731 root      20   0 2810480   1.7g   2280 S   0.0  1.4   0:03.14 nginx
> 12723 root      20   0 2810496   1.7g   2268 S   0.0  1.4   0:02.87 nginx
> 12737 root      20   0 2810660   1.7g   2280 S   0.3  1.4   0:03.89 nginx
> 12741 root      20   0 2810560   1.7g   2272 S   0.3  1.4   0:04.13 nginx
> 12681 root      20   0 2795668   1.7g    144 S   0.0  1.4   0:01.80 nginx
>
>
> --
> С уважением,
>  Дугин Сергей                          mailto:drug на qwarta.ru
>  QWARTA
>
> _______________________________________________
> nginx-ru mailing list
> nginx-ru на nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-ru
----------- следующая часть -----------
Вложение в формате HTML было извлечено…
URL: <http://mailman.nginx.org/pipermail/nginx-ru/attachments/20220110/dedf5cf9/attachment.htm>


Подробная информация о списке рассылки nginx-ru