Пухнет буфер кэша при использовании логирования
Пухнет кэш памяти если включить логирование. При нагрузке это становится критичным - память съедается и не высвобождается.
cat nginx.conf
worker_processes 2;
pid pid/nginx.pid;
events {
use epoll;
worker_connections 2048;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '[$time_local] "$request" $status $body_bytes_sent';
access_log off;
sendfile on;
keepalive_timeout 65;
server {
listen 8182;
access_log logs/8182.access.log main;
root /opt/http;
}
}
./nginx -V
nginx version: nginx/1.17.8
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)
built with OpenSSL 1.1.1d 10 Sep 2019
TLS SNI support enabled
configure arguments: --prefix=/opt/nginx --with-pcre=../pcre-8.43 --with-zlib=../zlib-1.2.11 --with-http_ssl_module --with-openssl=../openssl-1.1.1d --with-http_realip_module --with-http_stub_status_module
free -m
total used free shared buff/cache available
Mem: 4782 274 3501 73 1006 4134
Swap: 2047 0 2047
head -n1 ../logs/8182.access.log
[23/Dec/2020:13:47:58 +0200] "GET /1.html HTTP/1.1" 200 4
tail -n1 ../logs/8182.access.log
[23/Dec/2020:13:48:09 +0200] "GET /1.html HTTP/1.1" 200 4
cat ../logs/8182.access.log | wc -l
104262
free -m
total used free shared buff/cache available
Mem: 4782 276 3494 73 1012 4133
Swap: 2047 0 2047
за 11 сек. съело 6 метров