Reference · Glossary
Glossary
Canonical definitions for this course. When a term is defined here, lessons use it exactly this way.
Living documentGrows with each lesson
- event loop
- The single-threaded cycle at the heart of Redis: using the OS readiness API
(
epoll/kqueue), it watches many client sockets and services
ready ones one after another. What lets one thread handle tens of thousands of
connections.
— intro'd in lesson 0001
- single-threaded (command execution)
- Redis runs the execution of user commands on one thread — commands
are serialized into a single queue and run back-to-back, never in parallel. Refers to
command execution specifically, not the whole process.
— intro'd in lesson 0001
- atomicity (of a command)
- The property that a command runs to completion with no other command interleaving.
A free consequence of single-threaded execution — the reason a single Redis operation
needs no external lock.
— intro'd in lesson 0001
- head-of-line blocking
- Because there is one thread and one queue, a slow command at the front stalls every
client behind it. The root cause of most sudden Redis-wide latency spikes.
— intro'd in lesson 0001
- time complexity (as latency)
- A command's big-O, listed on every redis.io command page. On the shared single
thread it measures how long the command holds the one worker — i.e. the latency it
imposes on all clients, not just the caller.
— intro'd in lesson 0001
- threaded I/O
- An optional feature since Redis 6.0 that reads/parses requests and
writes replies across multiple threads. Command execution still runs on the single
main thread.
— intro'd in lesson 0001
- SCAN (vs KEYS)
- A cursor-based, O(1)-per-call iterator over the keyspace (with type variants
HSCAN/SSCAN/ZSCAN). The production-safe
alternative to the O(N), server-blocking KEYS.
— intro'd in lesson 0001
- UNLINK (vs DEL)
- Deletes a key but reclaims its memory in a background thread, so
freeing a large collection doesn't block command execution.
DEL frees
inline on the main thread.
— intro'd in lesson 0001
- hash (data type)
- A key holding a map of field → value. Field-level access (
HGET/HSET)
is O(1); reading the whole thing (HGETALL) is O(N). Model a record as a hash to
avoid read-modify-write of a whole JSON blob.
— intro'd in lesson 0002
- set (data type)
- An unordered collection of unique members. Membership (
SISMEMBER) and add
(SADD) are O(1); enumerating all members (SMEMBERS) is O(N). The
right answer to "have we seen X?".
— intro'd in lesson 0002
- sorted set (zset)
- A set whose members each carry a numeric score and are kept ordered by it.
ZADD/ZRANK are O(log N), ZRANGE is O(log N + M),
ZSCORE is O(1). The structure behind leaderboards, priority queues, and
time-ordered indexes.
— intro'd in lesson 0002
- big key
- A single key holding a very large collection. Dangerous because every O(N) command on it
monopolizes the single thread, and even
DEL is O(N). Fix with bounded
collections, *SCAN iteration, and UNLINK.
— intro'd in lesson 0002
- listpack (encoding)
- A compact, cache-friendly flat encoding Redis uses for small hashes/sorted sets/lists
(and
intset for small integer sets) below config thresholds. O(N) scans of a
listpack are trivially cheap; Redis auto-converts to hashtable/skiplist past the threshold.
Inspect with OBJECT ENCODING.
— intro'd in lesson 0002
← lesson 0001 · All lessons