Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Every time a worker performs a job, a cycle counter is increased. It is possible to change the default behaviour so the worker is killed every N cycles. Another process will be started by the parent once the child process reaches the max cycles, if the number of children processes doesn't reach the max_workers. It will prevent a worker memory get too big. This number can be adjusted, as, if it is too low, there is a cost associated in killing and starting a new process. 

MongoDB memory usage

MongoDB, in its default configuration, will use will use the larger of either 256 MB or ½ of (ram – 1 GB) for its cache size.

MongoDB cache size can be changed by adding the cacheSizeGB argument to the /etc/mongod.conf configuration file, as shown below.

Code Block
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
  wiredTiger:
      engineConfig:
         cacheSizeGB: 1

Here is an interesting information regarding how MongoDB reserves memory for internal cache and WiredTiger, the underneath technology. Also some adjustment that can be done: https://dba.stackexchange.com/questions/148395/mongodb-using-too-much-memory