Redis & Caching (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
What is Redis Lua Script Timeout and `SCRIPT KILL`?
senior LevelredisAdvanced Internals
In Simple Words: Because Lua scripts run atomically, an infinite loop freezes Redis completely:
- Configured by
lua-time-limit(default 5,000ms). - When a script exceeds the threshold, Redis accepts administrative commands and responds with
-BUSY. - You can execute
SCRIPT KILLto abort a read-only script. If the script already performed writes,SCRIPT KILLfails and you must executeSHUTDOWN NOSAVE.