Memcached vs. Redis

Introduction

This lesson discusses some of the real-world implementations of distributed cache that are widely adopted. Our focus will be on two well-known open-source, highly scalable, highly performant, and robust caching tools - Memcached and Redis. Both these techniques follow the client-server model and achieve a latency of sub-millisecond. Let’s dive deep into each one of them and then compare their usefulness.

1. Memcached

Memcached, introduced in 2003, is a key-value store distributed cache designed to store objects very fast. Memcached stores data in the form of key-value pair. Both the key and the value are strings. This means that any data stored will have to be serializedSerialization is the process of translating data into a format that can be transmitted or stored elsewhere. Later, reconstruction/deserialization of the data should be possible.. Thus, Memcached does not support and therefore, cannot manipulate different data structures.

Memcached has a client and server component each of which is necessary to run the system. The system is designed such that half the logic is encompassed in the server whereas the other half is in the client. However, each server follows the Shared-Nothing architecture. i.e., servers are unaware of each other and there is no synchronization, data sharing, and communication between the servers.

Due to the disconnected design, Memcached is able to achieve almost a deterministic query speed (O(1)) serving millions of keys per second using a high-end system. Thus, Memcached offers a high throughput and low latency.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy