Self-test
Check your understanding
Self-test11 questions
Why is pipelining often a 10x speedup even though Redis isn't doing less work?
Is a pipeline atomic? What can happen between its commands?
Why shouldn't you pipeline a million commands in one batch?
What does
MULTI/EXECguarantee, and what doesn't it?What happens to the other commands when one command fails at runtime inside
EXEC? At queue time?Why can't you implement "check balance, then debit" with
MULTIalone? Give two ways that work.How does
WATCHwork, and when does it perform badly?Why must every key a script touches be passed in
KEYS?What's the difference between
EVALscripts and Functions for persistence and deployment?A script has been running for 30 seconds and has already written. What are your options?
- Design question
Implement "transfer N points from user A to user B, failing if A has fewer than N" three ways (WATCH, Lua, Function) and compare them under heavy contention.