cacheSizeGB not working

crVersion: 1.12.0

error: error validating “perf-mongodb03_0.yaml”: error validating data: ValidationError( unknown field “cacheSizeGB” in; if you choose to ignore these errors, turn validation off with --validate=false

crVersion: 1.11.0

gets accepted

But in both cases


is always 50%

1 Like

Hi @jamoser!

spec.mongod section was removed in 1.12.0 and while you can specify cacheSizeGB under configuration section in replica set, BUT it will be overriden by autotuning.
What you can do is specify like this:

  - name: rs0
    size: 3
      antiAffinityTopologyKey: ""
      engine: wiredTiger
          cacheSizeRatio: 0.8
        cpu: "300m"
        memory: "4G"
        cpu: "300m"
        memory: "4G"

Ratio will be used to calculate the actual wiredTigerCacheSizeGB variable for mongodb.
Here’s a code that does it: percona-server-mongodb-operator/container.go at main · percona/percona-server-mongodb-operator · GitHub
If you have some other/better ideas on how it can be done please open a ticket in the Jira so it can be taken into consideration.

Thank you and all the best in the New Year!

1 Like

Thank you @Tomislav_Plavcic , but in our case we want to keep the cache size always at the same size whatever req/limit memory settings we have (it seems mongodb still “sees” the memory size of the node, not the one of the pod).

So in our case we want to set cacheSizeGB and not the ratio. I wonder why the original params of the MongoDB Operator are not available ?!

1 Like

Hi @jamoser !

I really cannot say what was the reason so I think it is best to report a Jira ticket in K8SPSMDB project and then it will be re-evaluated.