# Mongod pod does not respect limits.memory

**URL:** <https://forums.percona.com/t/mongod-pod-does-not-respect-limits-memory/11355>\
**Category:** Percona Operator for MongoDB\
**Created:** [July 14, 2021, 9:09pm UTC](https://forums.percona.com/t/mongod-pod-does-not-respect-limits-memory/11355 "2021-07-14T21:09:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamoser](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jamoser](https://forums.percona.com/u/jamoser)\
**Post date:** [July 14, 2021, 9:09pm UTC](https://forums.percona.com/t/mongod-pod-does-not-respect-limits-memory/11355/1 "2021-07-14T21:09:36Z")

</div>

Just tested and the pod(s) get OOM Killed when adding “too” much data.

This is the default configuration and I would expect that this could handle anything the disk can store.

```
storage:
  engine: wiredTiger
  inMemory:
    engineConfig:
      inMemorySizeRatio: 0.9
  wiredTiger:
    collectionConfig:
      blockCompressor: snappy
    engineConfig:
      cacheSizeRatio: 0.5
      directoryForIndexes: false
      journalCompressor: snappy
    indexConfig:
      prefixCompression: true

```

What I dont understand is

inMemorySizeRatio: 0.9  
cacheSizeRatio: 0.5  
OS cache

that would in fact result in most likely 150+% of the containers memory set by limits.memory.

Am I missing something ?

---

<div class="post-metadata">

**Author:** ![jamoser](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jamoser](https://forums.percona.com/u/jamoser)\
**Post date:** [July 14, 2021, 10:16pm UTC](https://forums.percona.com/t/mongod-pod-does-not-respect-limits-memory/11355/2 "2021-07-14T22:16:30Z")

</div>

Just as an example :

{“t”:{“$date”:“2021-07-14T22:11:48.774+00:00”},“s”:“W”, “c”:“CONTROL”, “id”:20720, “ctx”:“initandlisten”,“msg”:“Available memory is less than system memory”,“attr”:{“availableMemSizeMB”:8192,“systemMemSizeMB”:52232}}

what is systemMemSizeMB ? looks like this is the GKE node’s memory. pods memory limit is 8GB

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [July 27, 2021, 1:58pm UTC](https://forums.percona.com/t/mongod-pod-does-not-respect-limits-memory/11355/3 "2021-07-27T13:58:42Z")

</div>

@jamoser is this case similar to [systemMemSizeMB flag - can it be set externally - #4 by jamoser](https://forums.percona.com/t/systemmemsizemb-flag-can-it-be-set-externally/11367/4) ?

---

<div class="post-metadata">

**Author:** ![jamoser](https://avatars.discourse-cdn.com/v4/letter/j/b2d939/32.png) [@jamoser](https://forums.percona.com/u/jamoser)\
**Post date:** [December 27, 2022, 3:43pm UTC](https://forums.percona.com/t/mongod-pod-does-not-respect-limits-memory/11355/4 "2022-12-27T15:43:03Z")

</div>

See my answer in [MongoDB not respecting limits · Issue #936 · mongodb/mongodb-kubernetes-operator · GitHub](https://github.com/mongodb/mongodb-kubernetes-operator/issues/936)

→ I think Percona can’t do anything, it’s a MongoDB issue

---

<div class="post-metadata">

**Author:** ![Sumeet\_Chaudhari](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sumeet_chaudhari/32/15166_2.png) [@Sumeet\_Chaudhari](https://forums.percona.com/u/Sumeet_Chaudhari)\
**Post date:** [March 11, 2024, 3:27pm UTC](https://forums.percona.com/t/mongod-pod-does-not-respect-limits-memory/11355/5 "2024-03-11T15:27:13Z")

</div>

@jamoser seems they fixed the cgroup2 issue at [MongoDB not respecting limits · Issue #936 · mongodb/mongodb-kubernetes-operator · GitHub](https://github.com/mongodb/mongodb-kubernetes-operator/issues/936) was this also part of latest percona mongoDB operator
