redis (on lamp) is stuck due to high memory usage



  • I was migrating magento to a lamp app including redis as page cache. Everything worked fine for a few hours, but at some point I'm getting this message via email

    37daff30974b5378e8463859563b0028e07babc9ecda9b5663f38d1ab888baef  exited unexpectedly using too much memory!
    ...
    
    {"status":"oom","id":"37daff30974b5378e8463859563b0028e07babc9ecda9b5663f38d1ab888baef","from":"cloudron/redis:1.0.0","Type":"container","Action":"oom","Actor":{"ID":"37daff30974b5378e8463859563b0028e07babc9ecda9b5663f38d1ab888baef","Attributes":{"image":"cloudron/redis:1.0.0","location":"magentoshop.tld","name":"redis-b9e519bd-f638-4ba9-8334-1ab2c569b31a"}},"scope":"local","time":1531611212,"timeNano":1531611212713282300}
    
    -------------------------------------
    

    Usually a flushdb did the trick to get it working again, but right now I can't even send commands via cli, it's showing

    (error) LOADING Redis is loading the dataset in memory

    even if I only try to ping (or flushing) it. /usr/bin/redis-server is running wild on CPU, how can I stop it from loading and clear that db - and more importantly, how can I limit the memory on redis so it won't crash every few hours? I would be thankful for a quick reply, since I've already shut down the former machine and due to the missing cache, the magento shop is terribly slow.

    Best regards



  • The redis addon container is running on limited memory. Out of the box this is 150mb.
    You may want to try temporarily increase that with:

    docker update <container id> --memory 512m --memory-swap 1g
    

    Maybe the 150m is just too low for it to work well, given the magento load and thus it is busy doing garbage collection.



  • I've given the server more memory and after some time it eventually was able to clear out the db. I've also disabled redis for the time being and will try to play around with the allocated memory of your suggestion, thanks for that.

    Does this setting affect the maxmemory setting of redis? Some people suggest 1GB, others 2GB+ for several 1000 items in the db (current shop has 6000+), that wouldn't be a problem I reckon? I'll try some numbers next week and keep this thread updated if you like.



  • Would be great if you could update this thread with your findings. Also please note that the memory settings for the addons are currently not preserved across app restores or even server reboots. We are working on this fix and you can see the status of it at https://git.cloudron.io/cloudron/box/issues/566