cacheSizeGB not working

crVersion: 1.12.0

error: error validating “perf-mongodb03_0.yaml”: error validating data: ValidationError(PerconaServerMongoDB.spec.mongod.storage.wiredTiger.engineConfig): unknown field “cacheSizeGB” in com.percona.psmdb.v1-12-0.PerconaServerMongoDB.spec.mongod.storage.wiredTiger.engineConfig; if you choose to ignore these errors, turn validation off with --validate=false

crVersion: 1.11.0

gets accepted


But in both cases

–wiredTigerCacheSizeGB

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 replsets.storage.wiredTiger.engineConfig.cacheSizeRatio like this:

  - name: rs0
    size: 3
    affinity:
      antiAffinityTopologyKey: "kubernetes.io/hostname"
    storage:
      engine: wiredTiger
      wiredTiger:
        engineConfig:
          cacheSizeRatio: 0.8
    resources:
      limits:
        cpu: "300m"
        memory: "4G"
      requests:
        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