What would happen if we set memory-limit to mongodb docker container?

Basically we had a mongodb sharded cluster setup and running inside docker container. After several weeks, the container used all host memory and caused other containers crashed. To counter this, we config its memory limit so that it used 1/6 the host ram’s capacity. I assume it would lower mongodb performance, or at least make the contaner crash quicker. But it seems to run fine this time. What is the reason behind this? Can someone explain? Thank you

It shows a lot of warnings like these. Should I be worried?

Hi @Nam_Le and welcome to the community!!

For better understanding of above, it would be helpful if you could share the following details:

  1. What difference do you observe in terms of performance by lowering the RAM utilised by the container.

  2. Are there any errors seen due to lowering the memory limit?

  3. For how long was the container working smoothly before the container crash happened?

  4. The MongoDB version you are using

  5. MongoDB runtime setting files(e.g config files, command line options etc)

  6. The topology for the sharded deployment and if the shards are running on the same machine or different.

Could you also explain the above statement.

Can you also confirm that after modifying down the memory limit, everything works well?

Could you also confirm the origin of currentOp as this seems to be truncated in the logs screenshot shared. This warning implies that the output would be truncated in order to fit in 16MB document limit.

P.S.: please refer to the following documentation on Resource Constraint in Docker for more understanding.

Best regards

1 Like