Learn Labs
Transactions & Scripting

Self-test

Check your understanding

Self-test11 questions

—/11
  1. Why is pipelining often a 10x speedup even though Redis isn't doing less work?

  2. Is a pipeline atomic? What can happen between its commands?

  3. Why shouldn't you pipeline a million commands in one batch?

  4. What does MULTI/EXEC guarantee, and what doesn't it?

  5. What happens to the other commands when one command fails at runtime inside EXEC? At queue time?

  6. Why can't you implement "check balance, then debit" with MULTI alone? Give two ways that work.

  7. How does WATCH work, and when does it perform badly?

  8. Why must every key a script touches be passed in KEYS?

  9. What's the difference between EVAL scripts and Functions for persistence and deployment?

  10. A script has been running for 30 seconds and has already written. What are your options?

  11. 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.