Discover Centmin Mod today
Register Now

Beta Branch optimise nginx geoip module enabled memory usage for <768MB

Discussion in 'Centmin Mod Github Commits' started by eva2000, Nov 29, 2015.

Tags:
  1. eva2000

    eva2000 Administrator Staff Member

    29,049
    6,591
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,786
    Local Time:
    7:27 AM
    Nginx 1.13.x
    MariaDB 5.5
  2. eva2000

    eva2000 Administrator Staff Member

    29,049
    6,591
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +9,786
    Local Time:
    7:27 AM
    Nginx 1.13.x
    MariaDB 5.5

    Optimise Nginx GeoIP Module Enabled Memory Usage for <768MB Systems



    For Centmin Mod 123.09beta01 branch, optimise nginx memory usage on low memory systems <=768MB (~741MB after system overhead) or when NGINX_GEOIPMEM=n. When nginx geoip module is enabled (by default), nginx uses in memory caching of geoip country, city databases. When NGINX_GEOIPMEM=n is set, it changes it so that nginx uses disk based caching instead of memory based caching.

    If you do not use nginx geoip module at all, you can disable it in centmin.sh or via persistent configure file /etc/centminmod/custom_config.inc and set NGINX_GEOIP=n + recompile nginx via centmin.sh menu option 4 to disable the nginx geoip module completely.

    Default nginx geoip module enabled memory usage when enabled for memory caching
    Code:
    ps aufx | grep nginx | grep -v grep
    root      2608  0.0  1.5 173748 29196 ?        Ss   22:20   0:00 nginx: master process /usr/local/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    nginx     2610  0.0  1.7 181944 33708 ?        S<l  22:20   0:00  \_ nginx: worker process
    nginx     2611  0.0  1.7 181944 33696 ?        S<l  22:20   0:00  \_ nginx: worker process
    
    nginx geoip module enabled memory usage when switched from memory to disk caching via centmin.sh NGINX_GEOIPMEM=n variable. NGINX_GEOIPMEM=y is for default nginx memory cached geoip database data.
    Code:
    ps aufx | grep nginx | grep -v grep
    root     16457  0.0  0.3 153256  6496 ?        Ss   22:26   0:00 nginx: master process /usr/local/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    nginx    16458  0.0  0.5 161452 10876 ?        S<l  22:26   0:00  \_ nginx: worker process
    nginx    16459  0.1  0.5 161452 10876 ?        S<l  22:26   0:00  \_ nginx: worker process
    
    • VSZ difference = 181944 - 161462 = 20,492 = 20.01MB or 11.26% reduction
    • RSS difference = 33708 - 10876 = 22,832 = 22.3MB or 67.73% reduction
     
    Last edited: Nov 29, 2015