SlideShare uma empresa Scribd logo
1 de 5
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.

Mais conteúdo relacionado

Mais procurados

What CloudStackers Need To Know About LINSTOR/DRBD
What CloudStackers Need To Know About LINSTOR/DRBDWhat CloudStackers Need To Know About LINSTOR/DRBD
What CloudStackers Need To Know About LINSTOR/DRBD
ShapeBlue
 
Redis Introduction
Redis IntroductionRedis Introduction
Redis Introduction
Alex Su
 
Hadoop Ecosystem | Hadoop Ecosystem Tutorial | Hadoop Tutorial For Beginners ...
Hadoop Ecosystem | Hadoop Ecosystem Tutorial | Hadoop Tutorial For Beginners ...Hadoop Ecosystem | Hadoop Ecosystem Tutorial | Hadoop Tutorial For Beginners ...
Hadoop Ecosystem | Hadoop Ecosystem Tutorial | Hadoop Tutorial For Beginners ...
Simplilearn
 

Mais procurados (20)

Big Query - Utilizing Google Data Warehouse for Media Analytics
Big Query - Utilizing Google Data Warehouse for Media AnalyticsBig Query - Utilizing Google Data Warehouse for Media Analytics
Big Query - Utilizing Google Data Warehouse for Media Analytics
 
Best Practices for Integrating Active Directory with AWS Workloads
Best Practices for Integrating Active Directory with AWS WorkloadsBest Practices for Integrating Active Directory with AWS Workloads
Best Practices for Integrating Active Directory with AWS Workloads
 
Linux 101
Linux 101Linux 101
Linux 101
 
What CloudStackers Need To Know About LINSTOR/DRBD
What CloudStackers Need To Know About LINSTOR/DRBDWhat CloudStackers Need To Know About LINSTOR/DRBD
What CloudStackers Need To Know About LINSTOR/DRBD
 
Microsoft Windows Server 2022 Overview
Microsoft Windows Server 2022 OverviewMicrosoft Windows Server 2022 Overview
Microsoft Windows Server 2022 Overview
 
An Introduction to Kubernetes
An Introduction to KubernetesAn Introduction to Kubernetes
An Introduction to Kubernetes
 
Redis introduction
Redis introductionRedis introduction
Redis introduction
 
Cluster management with Kubernetes
Cluster management with KubernetesCluster management with Kubernetes
Cluster management with Kubernetes
 
A guide of PostgreSQL on Kubernetes
A guide of PostgreSQL on KubernetesA guide of PostgreSQL on Kubernetes
A guide of PostgreSQL on Kubernetes
 
Getting started with Amazon ElastiCache
Getting started with Amazon ElastiCacheGetting started with Amazon ElastiCache
Getting started with Amazon ElastiCache
 
Containers and workload security an overview
Containers and workload security an overview Containers and workload security an overview
Containers and workload security an overview
 
MongoDB Atlas
MongoDB AtlasMongoDB Atlas
MongoDB Atlas
 
Nosql
NosqlNosql
Nosql
 
Redis Introduction
Redis IntroductionRedis Introduction
Redis Introduction
 
Amazon Lightsail
Amazon LightsailAmazon Lightsail
Amazon Lightsail
 
Azure Cosmos DB
Azure Cosmos DBAzure Cosmos DB
Azure Cosmos DB
 
Hadoop Ecosystem | Hadoop Ecosystem Tutorial | Hadoop Tutorial For Beginners ...
Hadoop Ecosystem | Hadoop Ecosystem Tutorial | Hadoop Tutorial For Beginners ...Hadoop Ecosystem | Hadoop Ecosystem Tutorial | Hadoop Tutorial For Beginners ...
Hadoop Ecosystem | Hadoop Ecosystem Tutorial | Hadoop Tutorial For Beginners ...
 
NoSQL Architecture Overview
NoSQL Architecture OverviewNoSQL Architecture Overview
NoSQL Architecture Overview
 
Azure WAF
Azure WAFAzure WAF
Azure WAF
 
Postgresql tutorial
Postgresql tutorialPostgresql tutorial
Postgresql tutorial
 

Semelhante a Redis vs Memcached

Beyond relational database - Building high performance websites using Redis a...
Beyond relational database - Building high performance websites using Redis a...Beyond relational database - Building high performance websites using Redis a...
Beyond relational database - Building high performance websites using Redis a...
Dinh Pham
 

Semelhante a Redis vs Memcached (20)

Redis meetup
Redis meetupRedis meetup
Redis meetup
 
redis-demo.pptx
redis-demo.pptxredis-demo.pptx
redis-demo.pptx
 
Redis vs. MongoDB: Comparing In-Memory Databases with Percona Memory Engine
Redis vs. MongoDB: Comparing In-Memory Databases with Percona Memory EngineRedis vs. MongoDB: Comparing In-Memory Databases with Percona Memory Engine
Redis vs. MongoDB: Comparing In-Memory Databases with Percona Memory Engine
 
Beyond relational database - Building high performance websites using Redis a...
Beyond relational database - Building high performance websites using Redis a...Beyond relational database - Building high performance websites using Redis a...
Beyond relational database - Building high performance websites using Redis a...
 
Redis overview
Redis overviewRedis overview
Redis overview
 
Resilient Distributed DataSets - Apache SPARK
Resilient Distributed DataSets - Apache SPARKResilient Distributed DataSets - Apache SPARK
Resilient Distributed DataSets - Apache SPARK
 
Big Data and Hadoop
Big Data and HadoopBig Data and Hadoop
Big Data and Hadoop
 
Database
DatabaseDatabase
Database
 
Big Data: RDBMS vs. Hadoop vs. Spark
Big Data: RDBMS vs. Hadoop vs. SparkBig Data: RDBMS vs. Hadoop vs. Spark
Big Data: RDBMS vs. Hadoop vs. Spark
 
Managing Big data with Hadoop
Managing Big data with HadoopManaging Big data with Hadoop
Managing Big data with Hadoop
 
EN - Azure - Cache for Redis.pdf
EN - Azure - Cache for Redis.pdfEN - Azure - Cache for Redis.pdf
EN - Azure - Cache for Redis.pdf
 
How to boost performance of your rails app using dynamo db and memcached
How to boost performance of your rails app using dynamo db and memcachedHow to boost performance of your rails app using dynamo db and memcached
How to boost performance of your rails app using dynamo db and memcached
 
Redis Cashe is an open-source distributed in-memory data store.
Redis Cashe is an open-source distributed in-memory data store.Redis Cashe is an open-source distributed in-memory data store.
Redis Cashe is an open-source distributed in-memory data store.
 
Performance analysis of MongoDB and HBase
Performance analysis of MongoDB and HBasePerformance analysis of MongoDB and HBase
Performance analysis of MongoDB and HBase
 
No sql
No sqlNo sql
No sql
 
Hadoop file system
Hadoop file systemHadoop file system
Hadoop file system
 
Hadoop by kamran khan
Hadoop by kamran khanHadoop by kamran khan
Hadoop by kamran khan
 
NOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQLNOSQL- Presentation on NoSQL
NOSQL- Presentation on NoSQL
 
NOSQL in big data is the not only structure langua.pdf
NOSQL in big data is the not only structure langua.pdfNOSQL in big data is the not only structure langua.pdf
NOSQL in big data is the not only structure langua.pdf
 
Introduction to Redis and its features.pptx
Introduction to Redis and its features.pptxIntroduction to Redis and its features.pptx
Introduction to Redis and its features.pptx
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

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.