Build Your Own Redis with C/C++ EBook·Paperback
⟵ prev Contents next ⟶

ℹ️ New Book: Build Your Own Database

Build Your Own Redis with C/C++

Learn network programming and data structures by coding from scratch.

James Smith


Table of Contents

Part 1. Getting Started

  1. Introduction
  2. Introduction to Sockets
  3. Hello Server/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: Implementation and Testing
  4. The AVL Tree and the Sorted Set
  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.
See also: offers “Build Your Own X” courses in many programming languages.
Including Redis, Git, SQLite, Docker, and more.
Check it out

⟵ prev Contents next ⟶