7. Keys *• Don’t use keys command in production.
–“Warning: consider KEYS as a command
that should only be used in production
environments with extreme care” is
written in redis.io keys commands
manual.
10. FlushAll
• Redis’s FlushAll is slow and paused.
• But memcache’s flush is really fast.
–memcache doesn’t depend on Item count.
–Redis depends on Item count.
11. FlushAll
• What is different from memcache’s flush.
• Memcache just sets time to flush.
• Redis deletes all items.
–It spends 1 second in 1M or 2M items
12. FlushAll-Redis
long long emptyDb() {
for (int j = 0; j < server.dbnum; j++) {
dictEmpty(server.db[j].dict);
dictEmpty(server.db[j].expires);
}
return removed;
}
17. Redis Memory Policy
• In 64bit, Memory Policy doesn’t work,
if you don’t set maxmemory
parameter.
• In 32bit, maxmemory is set 4GB as
default
18. Default Setting in 64
• There is no memory limitation.
• So If you insert bigger data than
memory. It will be slow.
• But But But. Make sure
Vm.overcommit_memory property.
19. Memory Policy
• If you use Memory-Policy and
replication.
– It can cause some consistency problem.
Master SlaveDelete
propagation
Delete items because
of its own memory
policy
29. RDB - GOOD
• Can store data into persistent layer.
30. RDB - BAD
• Bad Performance in Large memory.
• Twice memory problem.
• Denying write problem when storing RDB
fails.
• If you just want Cache. Turn off RDB
31. RDB – Large Memory
• Performance is relevant to Memory
Size.
17.1 GB 34.2 GB
68.4 GB
117 GB
32. RDB - BAD
• Using bgsave in slave.
• Turning off RDB.
• Using save in master or slave.
33. RDB – Twice Memory
• fork() and COW(copy on write) Issue
–In Write Heavy System:
37. Real Case Study
• Background
–Can’t write to Redis Server
–Sentinel doesn’t find Server’s failure.
38. Real Case Study• Reason
– If redis fails to save RDB, Redis basically denies write
operations from client.
– “MISCONF Redis is configured to save RDB snapshots,
but is currently not able to persist on disk.
Commands that may modify the data set are disabled.
Please check Redis logs for details about the error.”
40. Real Case Study
• Solution #1
• Solution #2
config set stop-writes-on-bgsave-error no
Turn off RDB Setting
2.6.12 부터 conf 에서 stop-writes-on-bgsave-error
설정이 가능해짐.
41. SELECT Command
• Don’t use “SELECT” Command.
–You will not be able to use “SELECT” in
Redis Cluster.
• Redis Proxy can make some troubles.
42. Response Time
• Why memcache’s response time is
uniformed?
–Difference of Memory Allocator
Memcache Redis
- Slab Allocator - Just malloc()
43. Redis VS Memcache
• The popular question
–Redis and Memcache: What is better?
Memcache Redis
- Uniformed Response
Time
- More stable
- Data Structure
- Persistent