You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 35 Next »


Exercise caution while editing /usr/local/omk/conf/opCommon.nmis, /usr/local/omk/conf/opCommon.json or /etc/mongod.conf; if a syntax error is induced all OMK applications will cease to function.

Reducing a Server's Memory Footprint

  • ABI 1 (NMIS 8)

    • In omk/conf/opCommon.nmis:
      • omkd_workers is set at 10 by default. Try reducing this number to 2 and then restart the omkd service.
        If you THEN find YOU need more omkd_workers, increment this value by one and test again until you get to a suitable value for omkd_workers
      • /omkd/omkd_max_requests: 100 to 500 (start at 100 and increase from this value if needed)

  • ABI 2 (NMIS 9)

    • In omk/conf/opCommon.json:
      • omkd_workers is set at 10 by default. Try reducing this number to 2 and then restart the omkd service.
        If you THEN find YOU need more omkd_workers, increment this value by one and test again until you get to a suitable value for omkd_workers
      • /omkd/omkd_max_requests: 100 to 500 (start at 100 and increase from this value if needed)
    • in nmis9/conf/Config.nmis:
  • Consider installing and using zswap, with its default settings, provided the server has more than 1GB RAM

    • https://www.kernel.org/doc/html/latest/vm/zswap.html provides that:
      • Overcommitted guests that share a common I/O resource can dramatically reduce their swap I/O pressure, avoiding heavy handed I/O throttling by the hypervisor.
        This allows more work to get done with less impact to the guest workload and guests sharing the I/O subsystem.
      • Users with SSDs as swap devices can extend the life of the device by drastically reducing life-shortening writes.
    • Performance Analysis of Compressed Caching Technique
      • See the CONCLUSION of this paper for insights as to why zswap should not be used on a server with less than 1GB RAM.
    • https://www.ibm.com/support/pages/new-linux-zswap-compression-functionality provides that for a server with 10GB RAM and 20% zswap pool size: 
      • On x86, the average zswap compression ratio was 3.6
      • For the x86 runs, the pool limit was hit earlier - starting at the 15.5 GB data point
    • Don't be tempted to increase maximum pool percent from the default setting of 20: this will most likely affect performance adversely.
    • Command to view zswap info during operation:
      • sudo grep -rRn . /sys/kernel/debug/zswap/

  • Setting cacheSizeGB appropriately when MongoDB table type is wiredtiger (the default).

    If your MongoDB installation is using table type wiredtiger, please read
    https://docs.mongodb.com/manual/reference/configuration-options/#storage.wiredTiger.engineConfig.cacheSizeGB

    • Consider setting cacheSizeGB appropriately taking into consideration the memory requirements of other processes running on this box.
      With default mongod settings, a box with 16GB memory will most probably be currently set to use more than 7GB of memory for cacheSizeGB.

      This may be too much considering the box may be running NMIS, OMK and other applications too.
      • Check how much memory mongod is using for this cache at /var/log/mongodb/mongod.log:  search for cache_size where it is provided in MB, for example:
        • STORAGE [initandlisten] wiredtiger_open config: create,cache_size=7414M
          cacheSizeGB is set in GB, so a cache_size of 7414M is equivalent to the following setting in /etc/mongod.conf:
          • storage:
            • wiredTiger:
              • engineConfig:
                • cacheSizeGB: 7.24

      • Example where 60% was decided as the ratio that should be used to compute MongoDB cacheSizeGB on a VM with 8GB memory:
        • MONGO_USAGE=0.6
        • TOTAL_MEM=$(cat /proc/meminfo| grep -iF "memtotal" | awk '{print $2}')
          • returns TOTAL_MEM=7673702.4 (KB)
        • MONGO_MEM=$(echo "(${TOTAL_MEM} / (1024 * 1024)) * ${MONGO_USAGE}" | bc -l)
          • returns MONGO_MEM=4.390927734375 (GB)
        • MONGO_MEM=$(printf "%.2f" "${MONGO_MEM}")
          • returns  MONGO_MEM=4.39 (GB)
        • CACHE_MEM_FINAL=$(echo "((${MONGO_MEM} -1) * 0.5) / 1" | bc -l)
          • returns CACHE_MEM_FINAL=1.695 (GB)
        • CACHE_MEM_FINAL=$(printf "%.2f" "${CACHE_MEM_FINAL}")
          • returns CACHE_MEM_FINAL=1.70 (GB)
        • https://docs.mongodb.com/manual/reference/configuration-options/#storage-options
          IF CACHE_MEM_FINAL < 0.25 (GB) THEN CACHE_MEM_FINAL = 0.25 (GB)
        • echo $CACHE_MEM_FINAL
          • 1.7
        • Set cacheSizeGB to 1.7


Related Topics

  • No labels