Skip to content

Latest commit

 

History

History
63 lines (42 loc) · 1.81 KB

README.md

File metadata and controls

63 lines (42 loc) · 1.81 KB

Build Status

ngx_memory_leak_killer

ngx_memory_leak_killer can graceful restart a working process that exceeds the upper limit of memory usage. Thanks to nginx-hello-world-module and ngx_bumpylife.

Configuration

  • Enable "memory_leak_killer"
  • Set the upper limit of memory usage in kilobytes
http {
    memory_leak_killer on;
    memory_leak_killer_limit 5000; #5MB
    ...
}

Install

  • use nginx configure option
./configure --add-module=/path/to/ngx_memory_leak_killer

Example

$ ./work/sbin/nginx

$ ps auwxf |grep nginx
ubuntu   23505  0.0  0.0  16464   384 ?        Ss   08:46   0:00 nginx: master process ./work/sbin/nginx
ubuntu   23506  0.0  0.0  16908  1936 ?        S    08:46   0:00  \_ nginx: worker process

$ curl localhost:8080/memory
leak memory(+2MB)

$ ps auwxf |grep nginx
ubuntu   23505  0.0  0.0  16464   384 ?        Ss   08:46   0:00 nginx: master process ./work/sbin/nginx
ubuntu   23506  0.0  0.0  18864  4744 ?        S    08:46   0:00  \_ nginx: worker process

$ curl localhost:8080/memory
leak memory(+2MB)

$ ps auwxf |grep nginx
ubuntu   23505  0.0  0.0  16464   384 ?        Ss   08:46   0:00 nginx: master process ./work/sbin/nginx
ubuntu   23506  0.0  0.0  20820  6640 ?        S    08:46   0:00  \_ nginx: worker process

$ curl localhost:8080/memory
leak memory(+2MB)

$ ps auwxf |grep nginx
ubuntu   23505  0.0  0.0  16464   384 ?        Ss   08:46   0:00 nginx: master process ./work/sbin/nginx
ubuntu   23519  0.0  0.0  16908  1936 ?        S    08:46   0:00  \_ nginx: worker process





LICENSE

See LICENSE.