Redis Internals


A self-paced course where you will learn Redis internals by actually reimplementing its core features, like event loop, serialization protocol, persistence, pipelining, eviction, and transactions, in Golang.


The Course

Redis has to be the most versatile modern database out there. Although it is heavily used as a cache, it can also be used as a Message Broker, a Streaming engine, and so much more. This course will be an answer to some of your most common questions about Redis - why is it so fast? and how it can handle a large number of TCP connections while being single-threaded?

In this self-paced recorded course, we will be understanding the internals of Redis by actually reimplementing it in Golang, and the features include

  • event loop
  • serialization protocol
  • approximated LRU eviction
  • command pipelining and transactions

Our reimplementation in Golang will be an actual drop-in replacement of Redis which means you would be able to connect to this DB through any Redis client in the world! Our entire reimplementation is open-sourced and can be found on Github at DiceDB/dice.

Course curriculum


CHAPTER 1

Starting up

  • Course Introduction 10 mins
  • What makes Redis special? 22 mins
  • Writing a Simple TCP Echo Server 16 mins

CHAPTER 2

RESP, PING, and Event Loop

  • Speaking the Redis' Language 16 mins
  • Implementing RESP 15 mins
  • Implementing PING 19 mins
  • IO Multiplexing and Event Loops 21 mins
  • Handling multiple concurrent clients 26 mins

CHAPTER 3

GET, SET, and auto-delete

  • Implementing GET, SET, and TTL 22 mins
  • Implementing EXPIRE and auto-deletion 27 mins
  • Eviction strategies and implementing simple-first 20 mins

CHAPTER 4

Pipelining and Persistence

  • Implementing Command Pipelining 21 mins
  • Implementing AOF Persistence 21 mins

CHAPTER 5

Objects, statistics, and LRU

  • Object, Encodings, and Implementing INCR 25 mins
  • Implementing INFO and allkeys-random eviction 20 mins
  • The Approximated LRU Algorithm 23 mins
  • Implementing the Approximated LRU Algorithm 25 mins

CHAPTER 6

Memory management

  • Understanding how Redis caps memory 13 mins
  • Overriding malloc for better performance 6 mins

CHAPTER 7

Signals and Transactions

  • Implementing Graceful Shutdown 37 mins
  • Implementing Transactions 22 mins

CHAPTER 8

Core Data Structures and Algorithms

  • List Internals - Ziplist and Quicklist 28 mins
  • Set Internals - Intset 13 mins
  • Geospatial Queries and Geohash 21 mins
  • String Internals - Simple Dynamic Strings 16 mins
  • Hyperloglog and Cardinality Estimation 13 mins
  • LFU and Approximate Counting 21 mins

Why should you enroll?

The primary objective of this program is to make you fall in love with database internals, help you understand the various components of any database, and walk you through on building your own database from scratch.



Know the internals

Learning how a database is built from scratch and key design decisions that make it special has its own thrill.

Know the unknowns

Learn some of the most interesting concepts and super-clever algorithms that makes Redis extra-special.

Be a better engineer

Take yourself to the next level and become a better, an Asli Engineer.

Doubt Resolution

Get your doubts cleared asynchronously on Discord or synchronously over a common 30-minute zoom call that would happen every 14 days.

Network community

Network, interact, and learn by being a part of the Asli Engineering Discord community.

Glimpse of the course

The first few videos of this course are available for free, watch them here and then decide if you want to take this up or not



Program pre-requisites

In this course, we would be reimplementing the core features of Redis, like event loop, serialization protocol, persistence, pipelining, and eviction; hence we would need a basic familiarity with Go. We will also be writing our own Event Loop and because every OS exposes its own set of System Calls, we will be restricting ourselves to Linux, and hence having a Linux-based development environment is essential to follow. In a gist, the program pre-requisites are

  • basic familiarity with Go
  • linux-based development environment
  • a Google account because I only support Sign-in with Google :)

If you meet the pre-requisites and are excited to learn, enroll ↓

Buy Now

₹14,999 $199

inclusive of all the taxes


YOU'LL GET


9 hours of Redis Internals

Curated resources to explore internals better

Source code of our Golang based implementation - Dice DB

Bi-weekly doubt solving - Tuesday 7:30 pm to 8:00 pm IST

Lifetime access to all the course videos and notes

Lifetime access to the Discord Community

Language of communication will be strictly english

3 days no-questions-asked refund policy


Enroll Now

International folks, can also pay in USD or pay in EUR. In case you want to pay in any other currency, just drop me an email at arpit.masterclass@gmail.com.


Note: there is no discount on the course pricing; I feel discounts are unfair to the folks who paid the full; the price of the course is subject to a yearly hike.


If you have questions or need any clarifications before enrolling, please reach out to me at arpit.masterclass@gmail.com.



Arpit Bhayani

Hey, I am Arpit

tinkerer, educator, and entrepreneur

I am a software engineer and an engineering leader passionate about System Architecture, Databases Internals, Language Internals, and Advanced Algorithms. I am the creator and maintainer of DiceDB - a database hyper-optimized to build real-time applications with its SQL-based reactivity.

In 2024, I took the leap of faith and co-founded Profile.fyi, where I am operating as the CTO taking care of all things tech. Before this, I was a Staff Engineer at Google leading the Dataproc India team in providing a managed big data ecosystem to GCP customers. I was also part of Amazon's Fast Data Team and took care of cold tiering of hot data and providing a seamless query interface across all tiers.

I held engineering leadership positions (both IC and management) at Unacademy, where I built, grew, and led Search, Site Reliability Engineering (SRE) teams, and Data Engineering teams. I hold a total of 10+ years of experience in scaling backend services, taking products and teams from 0 to 1, and beyond.

I keep diving deep into engineering details and share my learnings by across my socials and videos on YouTube.

Arpit Bhayani

Frequently asked questions

You can always drop me an email at arpit.masterclass@gmail.com for other questions.


Is this course right for me?

This course is for any engineer who wants to understand the internals of Redis and build a KV store from scratch.

Will the sessions happen live?

The course is self-paced and upon the purchase, the access to the videos will be given.

Will you be resolving the doubts?

All the doubts will be resolved synchronously over a 30 min common zoom call that would happen every two weeks on Tuesday 7:30 pm IST, or asynchronously on the Discord server.

Can I get this course reimbursed from my company?

Talk to your manager and check if they can sponsor this course. The invoice that will be issued is a legally valid and sound invoice that can be used for any kind of reimbursement.

Will there be a recording available for future reference?

You will have lifetime access to the course.

Will I be able to change the cohort?

I will try but cannot guarantee to accomodate you in another cohort.

Is there a refund policy?

3 days no-questions-asked refund window from the date of course purchase.

What are the programming pre-requisites?

Basic familiarity with Golang and a Linux-based development environment.

Will I be getting an invoice of Payment?

Yes. An invoice will be issued to you with all the legal and necessary details. This means your employer can choose to process this invoice and provide reimbursement. Drop me an email at arpit.masterclass@gmail.com if you want a detailed invoice.

Will you issue a course completion certificate?

I generate the course completion certificate on-demand and hence if you seek one drop me an email at arpit.masterclass@gmail.com

Will you implement every single Redis command?

No. The commands and features that will be implemented are mentioned in the curriculum. Core Data Structures and Algorithms of Redis are theoretically covered in extreme detail. We will be following the aforementioned curriculum.

Will you live code?

No. I will be giving an exhaustive code walkthrough of our Golang based implementation and the code will evolve with every commit.


Arpit's Newsletter read by 100,000 engineers

Weekly essays on real-world system design, distributed systems, or a deep dive into some super-clever algorithm.