Search code examples
dockergoogle-cloud-platformredisvirtual-machineredisearch

Is it neccesary to increase VM memory for redis instance


Now I'm using 4CPU 8GB memory Virtual machine in GCP, and I'm also using redisearch docker container. I have 47.5Millon Hash keys and I estimate it is about 35GB over. So if I import all of my data at redis-cli in VM, It needs really 35GB over memory?

+ I already tried to import 7.5Millon but memory utilization is about 70% full

Solution

  • If your cache need 35Gb, then, your cache will need 35Gb.

    The values you gave are coherent. If 47M keys use 35Gb then 7.5M will use about 5.6Gb (which is also 70% of 8Gb).

    If you dont want to change your VM properties then you can use the swap property in the redis conf file to use part of the cold storage of the VM.

    Note that you have to be careful using swap, depending on the hardware it can be a pretty bad idea. Using anything but NVMes is bad (even SSDs), as you can see here :

    Benchmark with SSds

    Benchmark with NVMes