SlideShare a Scribd company logo
By Gaurav Agrawal
Redis Vs Memcached
Memcached or Redis? It's a question that nearly always arises in any discussion
about squeezing more performance out of a modern, database-driven Web
application. When performance needs to be improved, caching is often the first
step employed, and Memcached and Redis are typically the first places to turn.
Redis and Memcached
Redis
The name Redis means REmote DIctionary Server. Redis is an open source,
BSD licensed, advanced key-value store. It is often referred to as a data
structure server since keys can contain strings, hashes, lists, sets and sorted
sets. Redis is written in c.
Redis is an open source, advanced key-value store and a serious solution
for building high-performance, scalable web applications.
Redis has three main peculiarities that set it apart from much of its
competition:
 Redis holds its database entirely in memory, using the disk only for persistence.
 Redis has a relatively rich set of data types when compared to many key-value
data stores.
 Redis can replicate data to any number of slaves.
Memcached
Memcached is an open source, high-performance, distributed memory
caching system intended to speed up dynamic web applications by reducing
the database load. It is a key-value dictionary of strings, objects, etc,
By Gaurav Agrawal
stored in the memory, resulting from database calls, API calls, or page
rendering.
Memcached was developed by Brad Fitzpatrick for LiveJournal in 2003.
However, it is now being used by Netlog, Facebook, Flickr, Wikipedia,
Twitter, and YouTube among others.
The key features of Memcached are as follows −
 It is open source.
 Memcached server is a big hash table.
 It significantly reduces the database load.
 It is perfectly efficient for websites with high database load.
 It is distributed under Berkeley Software Distribution (BSD) license.
 It is a client-server application over TCP and/or UDP.
Memcached is not −
 a persistent data store
 a database
 application-specific
 a large object cache
 fault-tolerant or
 highly available
Redis vs Memcached
Similarities
 Both Memcached and Redis are in-memory.
 key-value data stores.
 They both belong to the NoSQL family.
By Gaurav Agrawal
 Both are based on the same key-value data model.
 They both keep all data in RAM, which makes them useful as a caching
layer.
 In terms of performance, the two data stores are also remarkably similar,
exhibiting almost identical characteristics (and metrics) with respect to
throughput and latency.
Differences
The main differences between them are listed below:
Installation:
Comparing ease of Installation Redis is much easier. No dependencies required.
Memory Usage:
For simple key-value pairs memcached is more memory efficient than Redis. If
you use Redis hashes, then Redis is more memory efficient.
Persistence:
If you are using Memcached then data is lost with a restart and rebuilding cache
is a costly process. On the other hand, Redis can handle persistent data. By
default, Redis syncs data to the disk at least every 2 seconds.
Replication:
By Gaurav Agrawal
Memcached does not supports replication. Whereas Redis supports master-slave
replication. It allows slave Redis servers to be exact copies of master servers.
Data from any Redis server can replicate to any number of slaves.
Storage type:
Memcached stores variables in it’s memory. It retrieve any information directly
from the servers memory instead of hitting the database again. On the other
hand, Redis is like a database that resides in memory. It executes (read and
write) a key/value pair from its database to return the resultset and all data
resides in memory. Developers are using Redis also for real-time metrics,
analytics.
Read/Write Speed:
Memcached is very good to handle high traffic websites. It can read lots of
information at a time and give you back at a great response time. Redis can
also handle high traffic on read but also can handle heavy writes as well.
Data Structure:
Memcached uses string and integer as data structure. Everything you save can
be either one or the other. With integer, the only data manipulation you can do
is adding or subtracting them. If you need to save arrays or objects, you will
have to serialize them first and then save them. To read them back, you will
need to un-serialize.
In comparison Redis has a stronger data structures. It can handle not only
strings, integer but also binary-safe strings, lists of binary-safe strings, sets of
binary-safe strings and sorted sets.
Key Length:
Memcached key length has a maximum of 250 bytes, whereas Redis key length
has a maximum of 2GB.
Redis can be used as a memcached on steroids because is as fast as
memcached but with a number of features more. Like memcached, Redis also
supports setting timeouts to keys so that this key will be automatically removed
when a given amount of time passes.
By Gaurav Agrawal
So, If you need advanced data structures or disk-backed persistence, you
should look into Redis. On the other hand, you might want to stick to
Memcached for its simplicity, reliability and speed.

More Related Content

PDF
Building Mini Embedded Linux System for X86 Arch
PPT
Monitoring using Prometheus and Grafana
ODP
Monitoring With Prometheus
PDF
Containerization is more than the new Virtualization: enabling separation of ...
PDF
Tadx - Présentation Conteneurisation
PPTX
An Introduction to ANTLR
PPTX
Ansible presentation
PDF
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon
Building Mini Embedded Linux System for X86 Arch
Monitoring using Prometheus and Grafana
Monitoring With Prometheus
Containerization is more than the new Virtualization: enabling separation of ...
Tadx - Présentation Conteneurisation
An Introduction to ANTLR
Ansible presentation
Anatomy of a Container: Namespaces, cgroups & Some Filesystem Magic - LinuxCon

What's hot (20)

PPTX
FreeRTOS basics (Real time Operating System)
PDF
Android framework design and development
ODP
import rdma: zero-copy networking with RDMA and Python
PDF
Platform values, Rust, and the implications for system software
PDF
Server monitoring using grafana and prometheus
PPTX
Prometheus - Intro, CNCF, TSDB,PromQL,Grafana
PDF
Docker 101: Introduction to Docker
PDF
Explore your prometheus data in grafana - Promcon 2018
PDF
Android's HIDL: Treble in the HAL
PPTX
An Introduction to Prometheus (GrafanaCon 2016)
PDF
Introduction to DevOps
PDF
Devops
PDF
Init of Android
PPTX
Introduction to docker
PDF
Midi technique - présentation docker
PPTX
Virtualization, Containers, Docker and scalable container management services
PDF
Process Scheduler and Balancer in Linux Kernel
PDF
Namespaces and cgroups - the basis of Linux containers
PDF
TP1 Big Data - MapReduce
PDF
Cours Big Data Chap5
FreeRTOS basics (Real time Operating System)
Android framework design and development
import rdma: zero-copy networking with RDMA and Python
Platform values, Rust, and the implications for system software
Server monitoring using grafana and prometheus
Prometheus - Intro, CNCF, TSDB,PromQL,Grafana
Docker 101: Introduction to Docker
Explore your prometheus data in grafana - Promcon 2018
Android's HIDL: Treble in the HAL
An Introduction to Prometheus (GrafanaCon 2016)
Introduction to DevOps
Devops
Init of Android
Introduction to docker
Midi technique - présentation docker
Virtualization, Containers, Docker and scalable container management services
Process Scheduler and Balancer in Linux Kernel
Namespaces and cgroups - the basis of Linux containers
TP1 Big Data - MapReduce
Cours Big Data Chap5
Ad

Similar to Redis vs Memcached (20)

PPTX
Redis meetup
PPTX
Introduction to Redis
PPTX
redis-demo.pptx
PDF
Redis vs. MongoDB: Comparing In-Memory Databases with Percona Memory Engine
ODP
Beyond relational database - Building high performance websites using Redis a...
PDF
Redis overview
PPTX
Resilient Distributed DataSets - Apache SPARK
PPTX
Big Data and Hadoop
PPT
Database
PDF
Big Data: RDBMS vs. Hadoop vs. Spark
PPTX
Managing Big data with Hadoop
PDF
EN - Azure - Cache for Redis.pdf
PDF
How to boost performance of your rails app using dynamo db and memcached
PDF
Redis Cashe is an open-source distributed in-memory data store.
PDF
Performance analysis of MongoDB and HBase
PDF
NOSQL -lecture 2 mongo database expalnation.pdf
PPT
No sql
PPTX
Hadoop file system
PPTX
Hadoop by kamran khan
PDF
NOSQL- Presentation on NoSQL
Redis meetup
Introduction to Redis
redis-demo.pptx
Redis vs. MongoDB: Comparing In-Memory Databases with Percona Memory Engine
Beyond relational database - Building high performance websites using Redis a...
Redis overview
Resilient Distributed DataSets - Apache SPARK
Big Data and Hadoop
Database
Big Data: RDBMS vs. Hadoop vs. Spark
Managing Big data with Hadoop
EN - Azure - Cache for Redis.pdf
How to boost performance of your rails app using dynamo db and memcached
Redis Cashe is an open-source distributed in-memory data store.
Performance analysis of MongoDB and HBase
NOSQL -lecture 2 mongo database expalnation.pdf
No sql
Hadoop file system
Hadoop by kamran khan
NOSQL- Presentation on NoSQL
Ad

Recently uploaded (20)

PPTX
TLE Review Electricity (Electricity).pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Spectroscopy.pptx food analysis technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Machine Learning_overview_presentation.pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Mushroom cultivation and it's methods.pdf
PPTX
Tartificialntelligence_presentation.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
August Patch Tuesday
TLE Review Electricity (Electricity).pptx
Programs and apps: productivity, graphics, security and other tools
Heart disease approach using modified random forest and particle swarm optimi...
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Spectral efficient network and resource selection model in 5G networks
Advanced methodologies resolving dimensionality complications for autism neur...
Spectroscopy.pptx food analysis technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Empathic Computing: Creating Shared Understanding
Machine Learning_overview_presentation.pptx
NewMind AI Weekly Chronicles - August'25-Week II
Diabetes mellitus diagnosis method based random forest with bat algorithm
Mushroom cultivation and it's methods.pdf
Tartificialntelligence_presentation.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Encapsulation_ Review paper, used for researhc scholars
Agricultural_Statistics_at_a_Glance_2022_0.pdf
August Patch Tuesday

Redis vs Memcached

  • 1. By Gaurav Agrawal Redis Vs Memcached Memcached or Redis? It's a question that nearly always arises in any discussion about squeezing more performance out of a modern, database-driven Web application. When performance needs to be improved, caching is often the first step employed, and Memcached and Redis are typically the first places to turn. Redis and Memcached Redis The name Redis means REmote DIctionary Server. Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets. Redis is written in c. Redis is an open source, advanced key-value store and a serious solution for building high-performance, scalable web applications. Redis has three main peculiarities that set it apart from much of its competition:  Redis holds its database entirely in memory, using the disk only for persistence.  Redis has a relatively rich set of data types when compared to many key-value data stores.  Redis can replicate data to any number of slaves. Memcached Memcached is an open source, high-performance, distributed memory caching system intended to speed up dynamic web applications by reducing the database load. It is a key-value dictionary of strings, objects, etc,
  • 2. By Gaurav Agrawal stored in the memory, resulting from database calls, API calls, or page rendering. Memcached was developed by Brad Fitzpatrick for LiveJournal in 2003. However, it is now being used by Netlog, Facebook, Flickr, Wikipedia, Twitter, and YouTube among others. The key features of Memcached are as follows −  It is open source.  Memcached server is a big hash table.  It significantly reduces the database load.  It is perfectly efficient for websites with high database load.  It is distributed under Berkeley Software Distribution (BSD) license.  It is a client-server application over TCP and/or UDP. Memcached is not −  a persistent data store  a database  application-specific  a large object cache  fault-tolerant or  highly available Redis vs Memcached Similarities  Both Memcached and Redis are in-memory.  key-value data stores.  They both belong to the NoSQL family.
  • 3. By Gaurav Agrawal  Both are based on the same key-value data model.  They both keep all data in RAM, which makes them useful as a caching layer.  In terms of performance, the two data stores are also remarkably similar, exhibiting almost identical characteristics (and metrics) with respect to throughput and latency. Differences The main differences between them are listed below: Installation: Comparing ease of Installation Redis is much easier. No dependencies required. Memory Usage: For simple key-value pairs memcached is more memory efficient than Redis. If you use Redis hashes, then Redis is more memory efficient. Persistence: If you are using Memcached then data is lost with a restart and rebuilding cache is a costly process. On the other hand, Redis can handle persistent data. By default, Redis syncs data to the disk at least every 2 seconds. Replication:
  • 4. By Gaurav Agrawal Memcached does not supports replication. Whereas Redis supports master-slave replication. It allows slave Redis servers to be exact copies of master servers. Data from any Redis server can replicate to any number of slaves. Storage type: Memcached stores variables in it’s memory. It retrieve any information directly from the servers memory instead of hitting the database again. On the other hand, Redis is like a database that resides in memory. It executes (read and write) a key/value pair from its database to return the resultset and all data resides in memory. Developers are using Redis also for real-time metrics, analytics. Read/Write Speed: Memcached is very good to handle high traffic websites. It can read lots of information at a time and give you back at a great response time. Redis can also handle high traffic on read but also can handle heavy writes as well. Data Structure: Memcached uses string and integer as data structure. Everything you save can be either one or the other. With integer, the only data manipulation you can do is adding or subtracting them. If you need to save arrays or objects, you will have to serialize them first and then save them. To read them back, you will need to un-serialize. In comparison Redis has a stronger data structures. It can handle not only strings, integer but also binary-safe strings, lists of binary-safe strings, sets of binary-safe strings and sorted sets. Key Length: Memcached key length has a maximum of 250 bytes, whereas Redis key length has a maximum of 2GB. Redis can be used as a memcached on steroids because is as fast as memcached but with a number of features more. Like memcached, Redis also supports setting timeouts to keys so that this key will be automatically removed when a given amount of time passes.
  • 5. By Gaurav Agrawal So, If you need advanced data structures or disk-backed persistence, you should look into Redis. On the other hand, you might want to stick to Memcached for its simplicity, reliability and speed.