Skip to main content
CF

Redis Internals

9h 6m 41s
English
Paid

This is a self-paced course where you will explore the internal workings of Redis by reimplementing its key features in Golang. Together, we will recreate mechanisms such as the event loop, serialization protocol, persistence, pipelining, eviction, and transactions.

Redis is one of the most versatile modern databases. Although it is often used as a cache, it can also function as a message broker, streaming engine, and much more. This course will answer your main questions about Redis: why is it so fast? and how does it handle a huge number of TCP connections while remaining single-threaded?

Throughout the course, we will deconstruct Redis step by step, and in the process, we will write its full implementation in Go. The implementation will be compatible with any Redis client in the world - you will be able to connect to our database just like with the real Redis! All the code is available in open access on GitHub (DiceDB/dice).

Why enroll?

  • Understand the architecture from the inside
    • You will learn how databases are created from scratch and understand the key architectural decisions that make Redis so unique.
  • Explore the "unknown"
    • Master the most intriguing concepts and "tricky" algorithms that underlie the high speed and flexibility of Redis.
  • Become a better engineer
    • You will grow as a developer and be able to call yourself a true "Asli Engineer."

Participant Requirements

We will be implementing the main mechanisms of Redis, such as the event loop, serialization protocol, persistence, pipelining, and eviction. Therefore, it is important to have:

  • basic knowledge of Go
  • a development environment on Linux
  • a Google account (as only Google sign-in is supported)

Additional

https://github.com/dicedb/dice

About the Author: Arpit Bhayani

Arpit Bhayani thumbnail

Arpit Bhayani is a US-based software engineer (formerly at Amazon, Practo, and now an independent educator) who runs asliengineering.com and the Arpit Bhayani YouTube channel, both focused on system design and database internals. His material is unusually deep for the system-design-interview market — taking serious detours into the actual implementation of Redis, Postgres, and the data structures behind them.

His CourseFlix listing carries three Arpit Bhayani courses: The System Design Masterclass, Redis Internals (an end-to-end study of how Redis is implemented in C), and System Design for Beginners. Material is paid and aimed at engineers preparing for system-design interviews or doing infrastructure work on production data systems.

Watch Online 28 lessons

This is a demo lesson (10:00 remaining)

You can watch up to 10 minutes for free. Subscribe to unlock all 28 lessons in this course and access 10,000+ hours of premium content across all courses.

View Pricing
0:00
/
#1: Course Introduction
All Course Lessons (28)
#Lesson TitleDurationAccess
1
Course Introduction Demo
10:55
2
What makes Redis special?
22:04
3
Writing a Simple TCP Echo Server
16:25
4
Speaking the Redis' Language
15:50
5
Implementing RESP
14:38
6
Implementing PING
19:29
7
IO Multiplexing and Event Loops
21:15
8
Handling multiple concurrent clients
26:29
9
Implementing GET, SET, and TTL
22:09
10
Implementing DEL, EXPIRE and auto-deletion
27:23
11
Eviction strategies and implementing simple-first
20:24
12
Implementing Command Pipelining
22:00
13
Implementing AOF Persistence
21:05
14
Object, Encodings, and Implementing INCR
24:48
15
Implementing INFO and allkeys-random eviction
19:37
16
The Approximated LRU Algorithm
23:15
17
Implementing the Approximated LRU Algorithm
25:27
18
Understanding how Redis caps memory
13:20
19
Overriding malloc for better performance
06:11
20
Implementing Graceful Shutdown
37:18
21
Implementing Transactions
22:00
22
List Internals - Ziplist and Quicklist
28:16
23
Set Internals - Intset
13:25
24
Geospatial Queries and Geohash
21:39
25
String Internals - Simple Dynamic Strings
15:56
26
Hyperloglog and Cardinality Estimation
13:22
27
LFU and Approximate Counting
20:49
28
What next?
01:12
Unlock unlimited learning

Get instant access to all 27 lessons in this course, plus thousands of other premium courses. One subscription, unlimited knowledge.

Learn more about subscription

Related courses

Frequently asked questions

What are the prerequisites for enrolling in this course?
To get the most out of this course, you should have a solid understanding of the Golang programming language, as the course involves reimplementing Redis features in Golang. Familiarity with basic concepts of Redis such as data types, commands, and basic operations can be beneficial. Additionally, having experience with network programming and understanding TCP protocols will help, as the course includes tasks like writing a TCP Echo Server.
What projects or tasks will I complete during the course?
Throughout the course, you will engage in hands-on projects such as writing a Simple TCP Echo Server, implementing the Redis Serialization Protocol (RESP), creating mechanisms for GET, SET, and TTL commands, and developing systems for eviction strategies. You will also work on complex tasks like command pipelining, AOF persistence, and implementing transactions. These projects are designed to help you understand the internal workings of Redis by building its key features from scratch.
Who is the target audience for this course?
The course is aimed at developers and software engineers who are interested in learning about the internal mechanisms of Redis. It is particularly suited for those who want to deepen their understanding of data storage systems and improve their skills in systems programming with Golang. This course will also benefit those looking to enhance their knowledge of network programming and memory management techniques.
How does the depth and scope of this course compare to other Redis courses?
Unlike many Redis courses that focus on usage and basic operations, this course dives deeply into the internals of Redis by guiding students to implement its key features in Golang. It covers advanced topics such as IO multiplexing, memory capping, eviction algorithms, and performance optimization techniques like overriding malloc. This makes it a suitable choice for learners seeking a comprehensive understanding of how Redis works under the hood.
What specific tools or platforms will I be using in this course?
The primary tool used in this course is the Golang programming language, which students will use to reimplement Redis features. You will also work with TCP protocols and network programming concepts while building a TCP Echo Server and implementing IO multiplexing. Familiarity with Golang's standard libraries and development environment will be essential as you progress through the course.
What topics or features are not covered in this course?
While the course provides a detailed exploration of Redis internals, it does not cover the use of Redis in production environments or its integration with other systems and applications. It focuses primarily on reimplementing Redis features rather than deploying or managing Redis servers. Additionally, topics like Redis clustering, security, and advanced configuration settings are not part of the curriculum.
What is the expected time commitment for completing this course?
The course is self-paced, allowing students to progress according to their own schedules. With 28 lessons, students should expect to dedicate a significant amount of time to both the video content and the hands-on coding exercises. Depending on prior experience with Golang and Redis, the total time commitment can vary. Allocating several hours per week will enable steady progress through the course material.