Table of Contents

Part 1. Getting Started

  1. Introduction
  2. Socket Programming Concepts
  3. TCP Server and Client
  4. Protocol Parsing
  5. The Event Loop and Nonblocking IO
  6. The Event Loop Implementation
  7. Basic Server: get, set, del

Part 2. Essential Topics

  1. Data Structure: Hashtables
  2. Data Serialization
  3. The AVL Tree: Coding & Testing
  4. Sorted Set From AVL Tree
  5. The Event Loop and Timers
  6. The Heap Data Structure and the TTL
  7. The Thread Pool and Asynchronous Tasks

Source Code

PDF/EPUB and Paperback Editions

The book is available for purchase.

Book Cover

I have curated a list of books that are highly relevant for people who intend to DIY their own Redis.

Beej’s Guide to Network Programming.
[Amazon] [Web]
A comprehensive guide and reference to network programming. It’s a great supplement for coding your own networked apps, as the Redis book doesn’t cover all the details of socket programming.
The Linux Programming Interface by Michael Kerrisk.
[Amazon] [Web]
The socket API is only a subset of the Linux API interface. You will probably need to become familiar with the other parts, such as IOs, threads and processes, signals, and etc, if you are developing apps for Linux.
The C Programming Language by K&R.
Are you scared of C, but still want to follow the project? No problem. This classic book is great for picking up C quickly, whether you are a beginner or an experienced developer.