Configure Redis as cache (maxmemory 2mb) redis.io docs
Hello, i come back again after i see this: https://redis.io/docs/manual/config/
Now have another topic, say's 100mb: https://redis.io/docs/manual/eviction/
But still, i want to understand the idea of 2mb? i configure Redis as a cache and disable snapshots + disable the stoping on writing in background error:
# Snapshots Redis - DB
sed -i "s/# save \"\"/save \"\"/" /etc/redis/redis.conf
# Memory System
sed -i "s/stop-writes-on-bgsave-error yes/stop-writes-on-bgsave-error no/" /etc/redis/redis.conf
sed -i "s/# maxmemory-policy noeviction/maxmemory-policy allkeys-lru/" /etc/redis/redis.conf
I use "sed", i sure you know. As you see, i turn off the snapshot completely (save "") empty string. and i did maxmemory 2mb, i get good results. But still i want to understand what the idea behind what wrote in redis.io
This 2mb actually be better for a little machine like mine? Or it actually consumes more RAM?
Be happy to explanation about that.
Another issue i notice is, even if i turn off the snapshot. When SWAP LINUX accrue,
I see have RDB got saved (5mb) something like that. This after i comment out in redis.conf:
save ""
stop-writes-on-bgsave-error no
Its normal? Even if i turn off the Redis snapshots? Or I have issue with Redis and swaps?
no answer about the 2 megabyte?
Hi @Yossifsolman
The 2mb value in the docs is just an example, not a recommendation. You should set your max-memory depending on your needs and the server's resources.
As for the RDB you've found on your disk, disabling snapshots means that Redis will not create them automatically. However, RDBs are still generated if you call the SAVE or BGSAVE commands.
I hope this answers your questions.