AlgoDaily

Redis (Uber)

Read at your own pace. Code execution, quizzes, progress tracking, and the AI tutor are available in the interactive view with JavaScript enabled.

Introduction

In this tutorial, we will dive into the architecture of Redis, its features, and how it contributes to the architecture of Uber.

Uber uses Redis for caching and queuing. Some Redis instances are behind Twemproxy (a proxy server that allows you to reduce the number of open connections to a Redis server) and some are behind a custom clustering system.

Redis

Redis is an in-memory data structure store. It is often used as a database, an in-memory cache, and a message broker. Redis supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, HyperLogLogs (a probabilistic data structure used to count unique values), geospatial indexes with radius queries, and streams.

Redis has built-in replication (ensures high availability), Lua scripting (a high-level programming language), LRU eviction (Least Recently Used; maximizes cache capacity), transactions, and varying levels of on-disk persistence. It also provides high availability via the Redis Sentinel and automatic partitioning with Redis Cluster.

You can run atomic operations such as appending to a string, incrementing a value in a hash, pushing an element to a list, computing set intersection, and determining which member has the highest rank in a sorted set.

Redis also supports trivial-to-setup master-slave asynchronous replication with very fast non-blocking first synchronization, auto-reconnection with partial resynchronization on netsplit. Other features include pub/sub, Keys with a limited time-to-live, and automatic failover. Additionally, you can use Redis with most programming languages.

General Flow

CONTINUE WITH ALGODAILY PREMIUM

Keep going with the complete tutorial.

Unlock the remaining explanations and exercises, alongside the full learning library.

Explore Premium →
Open interactive view →