Build your own Redis

Learn about TCP servers, the Redis protocol and more

Redis is an in-memory data structure store often used as a database, cache, message broker and streaming engine. In this challenge you'll build your own Redis server that is capable of serving basic commands, reading RDB files and more.

Along the way, you'll learn about TCP servers, the Redis Protocol and more.

Stages

Bind to a port
Respond to PING
Respond to multiple PINGs
Handle concurrent clients
Implement the ECHO command
Implement the SET & GET commands
Expiry

RDB Persistence

RDB file config
Read a key
Read a string value
Read multiple keys
Read multiple string values
Read value with expiry

Replication

Configure listening port
The INFO command
The INFO command on a replica
Initial Replication ID and Offset
Send handshake (1/3)
Send handshake (2/3)
Send handshake (3/3)
Receive handshake (1/2)
Receive handshake (2/2)
Empty RDB Transfer
Single-replica propagation
Multi Replica Command Propagation
Command Processing
ACKs with no commands
ACKs with commands
WAIT with no replicas
WAIT with no commands
WAIT with multiple commands

Streams

The TYPE command
Create a stream
Validating entry IDs
Partially auto-generated IDs
Fully auto-generated IDs
Query entries from stream
Query with -
Query with +
Query single stream using XREAD
Query multiple streams using XREAD
Blocking reads
Blocking reads without timeout
Blocking reads using $

Transactions

The INCR command (1/3)
The INCR command (2/3)
The INCR command (3/3)
The MULTI command
The EXEC command
Empty transaction
Queueing commands
Executing a transaction
The DISCARD command
Failures within transactions
Multiple transactions