Redis Settings - redis.config
Memory usage limits
Default value
32bit System: 3GB
64bit System: 0
0: Unlimited use of operating system virtual memory (swap)
When memory is full, remove the key according to the uninstall policy.
It must be greater than the maximum memory usage for one Cache.
Plain Text
1
maxmemory 1gb| 1k | 1kb | 1m | 1mb | 1g | 1gb |
| 1,000 bytes | 1024 bytes | 1,000,000 bytes | 1024*1024 bytes | 1,000,000,000 bytes | 1012*1024*1024 bytes |
Remove Policy
LFU support starting with Redis 4.0
Use the DEL command to remove the key.
DEL commands are executed in Main Thread.
Plain Text
1
maxmemory-policy volatile-lrunoeviction
Do not run the uninstall policy.An error occurs when a write operation is performed with full memory.
Plain Text
1
2
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: OOM command not allowed when used memory > 'maxmemory'.] with root cause
io.lettuce.core.RedisCommandExecutionException: OOM command not allowed when used memory > 'maxmemory'.volatile
Execute an uninstall policy on the EXPIRE SET (the set of keys with Expire set).
If there is no object to be removed, it acts like noeviction.
| volatile-lru | The LRU algorithm removes the longest unreferenced key.(Recommended if you want to keep a single cache server, key permanently |
| volatile-lfu | The LFU algorithm removes the key with the least number of references. |
| volatile-random | Optionally remove the key.(Recommended if you want to keep a single cache server, key permanently |
| volatile-ttl | Remove the key with the least time-to-live (TTL) value (recommended if you use a different TTL for each key). |
allkeys
Enable uninstall policy for all keys
| allkeys-lru | The LRU algorithm removes the longest unreferenced key.(Recommended if only certain keys are used a lot in some cases) |
| allkeys-lfu | The LFU algorithm removes the key with the least number of references. |
| allkeys-random | Optionally remove the key.(Recommended if all keys are used uniformly) |
Number of candidates to be removed
Compare and eliminate candidate groups that meet the elimination policy.
Plain Text
1
maxmoery-samples 3Asynchronous Removal (Redis 4.0)
Settings to prevent Blocking from occurring when the purge policy is run, removing multiple keys at once
If yes is set, LazyFreeThread is performed in the background using the UNLINK command rather than the DEL command.
Plain Text
1
lazyfree-lazy-eviction yesUse the UNLINK command to asynchronously remove the key when the uninstall policy is executed.
Plain Text
1
lazyfree-lazy-expire yesUse the UNLINK command to delete expired keys.
Plain Text
1
lazyfree-lazy-server-del yesUse UNLINK commands when executing SET or RENAME commands for keys that already exist.
Plain Text
1
lazyfree-lazy-user-del yesThe DEL command works internally as a UNLINK command.(Redis 6.0)
Plain Text
1
slave-lazy-flush yesWhen replicating the entire data on the Master server to the Clone server, it is deleted with the FLUSHALL async command.Although synchronization speed is fast, additional memory may be required because new data is received without all existing data being deleted.
Reference

민갤
Back-End Developer
백엔드 개발자입니다.

Redis-Cli (Redis command line)
Redis-Cli
Server

Web Front-End Developer Novice study 2회차 - 브라우저 동작 원리
Web Front-End Developer Novice 스터디 2회차 정리글입니다.
Technique