Why use both memcached and redis?

Why don’t replace memcached with another redis instance?


Course: https://www.educative.io/courses/grokking-modern-system-design-interview-for-engineers-managers
Lesson: Initial Design of Quora - Grokking Modern System Design Interview for Engineers & Managers

@Jiao_Peng

Memcached caches frequently accessed data, such as user profiles, to reduce database load and improve website performance. It is also used to save the results of database searches that are too expensive to perform repeatedly. It also maintains session data, allowing Quora to maintain a state between requests without storing anything in the database.

Conversely, Redis has features such as persistence, pub/sub messaging, and Lua scripting. Redis can manage more complex data structures, such as lists, sets, and hashes, and provide additional features such as ranking and scoring Quora answers, tracking user activity and sending real-time notifications and messages.

To summarise, Quora uses Memcached and Redis in its high-level architecture because they provide various advantages and are optimized for specific data structures and use cases. Memcached improves the performance of simple, frequently accessed data, but Redis is utilized for more complicated data structures and additional features such as messaging and persistence.

Consider reading Memcached versus Redis lesson for further comparison between the two.

Happy learning at Educative.

1 Like