What Redis is and when it beats a database

Redis Course · lesson 1 of 19 · 4 min read

Redis is an in-memory data structure server, which buys latency and costs you durability.

Open this lesson in the learning hub

Key points

  • Redis holds the entire dataset in RAM, so a read is a memory lookup plus one network round trip.
  • Command execution is single threaded, which is exactly why every individual command is atomic.
  • Redis 6.0 added io-threads, but that parallelises socket reads and writes only, never command execution.
  • It is not a relational replacement: there are no joins, no schema and no query planner to lean on.
  • The default port is 6379, and a standalone server exposes 16 numbered databases via SELECT.
  • RAM costs far more per GB than disk, so Redis earns its keep on the hot slice, not the archive.

Example

$ redis-cli SET user:1000:name "Ada"
OK
$ redis-cli GET user:1000:name
"Ada"
$ redis-cli OBJECT ENCODING user:1000:name
"embstr"
$ redis-cli --latency
min: 0, max: 1, avg: 0.11 (1180 samples)
$ redis-cli INFO server
redis_version:7.2.4
tcp_port:6379

Redis trades durability and query power for microsecond access to the data you touch most.

This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the Redis Course course, and every lesson in it is listed on the Redis Course contents page.