SlideShare uma empresa Scribd logo
1 de 14
REDIS
Is it Memcached with persistence and more data types?
Prabhu Missier
Samvit Software Solutions
Melbourne, Australia
What is REDIS
• An in-memory nosql data structure store vs Memcached is a key/value store
• Caching is just one of its options
• Several powerful data-types such as Hashes, Sorted Sets
• Persistence to disk
• In-built cluster support
• By default is not LRU
• Values can be upto 512MB in size vs 1MB for Memcached
What is REDIS
• Generally used as a persistent data store with LRU configured when it reaches
maximum capacity
• Can selectively delete items in the cache
• Suitable for Key -> someObject scenarios as opposed to Key -> string Memcached
scenarios
• Can selectively invalidate items in the cache
• REDIS is limited to a single core but now with 3.0 includes out-of-the-box cluster
support
REDIS – Memory Management
• Has no fixed Max Memory limit on the cache instance
• By default uses the jemalloc memory allocator which cannot keep up with a
high rate of allocations and purging
• More objects put in, more memory is used
• Certain loads could cause memory leaks at times
MEMCACHED- Memory Mgmt
• Allocates one large chunk of memory. The max page size is 1MB
• Uses its own slab-allocator and remember each slab-class has its own LRU
• This means memory chunks get allocated only from their specific class even if there’s a free
chunk in another slab-class
• Internal fragmentation is low as it uses per-slab LRU algorithm
• Suitable where memory usage has to be enforced
• Consistent hashing is used which reduces key misses.
• REDIS doesn’t match up when for this use case – LRU based, non-persistent
Slab Allocation
• Frequent initialization and destruction of kernel objects can hamper
performance.
• When an object is destroyed the memory is not released. Instead it gets
added to a list of available nodes
• The memory gets reused when a similar type of object has to be initialized
• Minimizes fragmentation by avoiding frequent allocation/deallocation
• Ref : https://en.wikipedia.org/wiki/Slab_allocation
Where does REDIS make sense
• Handles variety of formats : lists, sets, array
• Working with sorted sets in memory. It beats memcached here
• collating page clicks analytics data
• displaying real-time leaderboard info
• High speed data ingest
• Message queuing
• Session Storage
REDIS pros
• Works better with a geographically distributed cache, say AWS zones
• Pipelining helps in multiple operations on cached datasets at once
• Stores data in a variety of formats : sets, lists, sorted sets, bitmaps, hashes, geospatial indices. Atomic ops on
these is possible. Eg. Push new elem to list
• Blocking reads – will wait till a write completes
• Backs data to disk
• Partitions data across multiple REDIS instances
• Fine-tune cache contents by choosing from 6 eviction policies
• Persistent by default, so restarts are better. No cache warmup is needed
• Lua scripting
REDIS cons
• SENTINEL which controls slave-master promotion is unstable. If it fails
then failover from slave-master fails
• Complex to configure and administer for monitoring, partitioning &
balancing
• Ref: http://www.bigdatalittlegeek.com/blog/2014/3/25/memcached-vs-
redis
Where does MEMCACHED make sense
• Database queries, reduce read load on databases
• Page fragments
• REST round trips
MEMCACHED pros and cons
• PROS
• Low complexity, easy to configure, simple to cluster since a hashing algo is used by the client to shard
across the cluster
• CONS
• Is just an in-memory key-value store
• Caches sharded by client can’t be distributed across AWS zones
• Adding a member to the pool requires a client reconfigure and re-start
• Eviction policy is LRU and sometimes the object being evicted is simply the same size as the new one
http://www.bogotobogo.com/DevOps/Redis/Redis_vs_Memcached.php
• Cache misses happen on a restart
MEMCACHED pros and cons
• MEMCACHED is supposed to perform better when there are concurrent
requests
• Eviction policy is better implemented
• Depends on:
• Type of hardware,Types of data you store
• Amount of get and set, App concurrency
• Do you need data structure storage
A word on clustering
Consistent hashing on Memcached is still a more robust model for graceful
failure (at least if you are using it as a transient cache) than the Redis sharding.
As nodes fall the cache keys automatically move to other servers. As long as
you have a single server your cache still operates, albeit poorly. As opposed to
redis where, to my understanding, if you lose master and slave for any
hashgroup your cluster fails.
References
• http://www.bigdatalittlegeek.com/blog/2014/3/25/memcached-vs-redis
• http://www.bogotobogo.com/DevOps/Redis/Redis_vs_Memcached.php
• http://blog.andolasoft.com/2014/02/memcached-vs-redis-which-one-to-pick-for-large-web-app.html
• https://www.adayinthelifeof.nl/2011/02/06/memcache-internals/
• http://stackoverflow.com/questions/4188620/redis-and-memcache-or-just-redis?rq=1
• http://stackoverflow.com/questions/7888880/what-is-redis-and-what-do-i-use-it-for?rq=1
• http://stackoverflow.com/questions/10558465/memcached-vs-redis?rq=1
• http://stackoverflow.com/questions/23601622/if-redis-is-already-a-part-of-the-stack-why-is-memcached-
still-used-alongside-r?rq=1
• http://stackoverflow.com/questions/10558465/memcached-vs-redis

Mais conteúdo relacionado

Último

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 

Último (20)

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 

Destaque

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Destaque (20)

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 

Redis - A comparative study with Memcached

  • 1. REDIS Is it Memcached with persistence and more data types? Prabhu Missier Samvit Software Solutions Melbourne, Australia
  • 2. What is REDIS • An in-memory nosql data structure store vs Memcached is a key/value store • Caching is just one of its options • Several powerful data-types such as Hashes, Sorted Sets • Persistence to disk • In-built cluster support • By default is not LRU • Values can be upto 512MB in size vs 1MB for Memcached
  • 3. What is REDIS • Generally used as a persistent data store with LRU configured when it reaches maximum capacity • Can selectively delete items in the cache • Suitable for Key -> someObject scenarios as opposed to Key -> string Memcached scenarios • Can selectively invalidate items in the cache • REDIS is limited to a single core but now with 3.0 includes out-of-the-box cluster support
  • 4. REDIS – Memory Management • Has no fixed Max Memory limit on the cache instance • By default uses the jemalloc memory allocator which cannot keep up with a high rate of allocations and purging • More objects put in, more memory is used • Certain loads could cause memory leaks at times
  • 5. MEMCACHED- Memory Mgmt • Allocates one large chunk of memory. The max page size is 1MB • Uses its own slab-allocator and remember each slab-class has its own LRU • This means memory chunks get allocated only from their specific class even if there’s a free chunk in another slab-class • Internal fragmentation is low as it uses per-slab LRU algorithm • Suitable where memory usage has to be enforced • Consistent hashing is used which reduces key misses. • REDIS doesn’t match up when for this use case – LRU based, non-persistent
  • 6. Slab Allocation • Frequent initialization and destruction of kernel objects can hamper performance. • When an object is destroyed the memory is not released. Instead it gets added to a list of available nodes • The memory gets reused when a similar type of object has to be initialized • Minimizes fragmentation by avoiding frequent allocation/deallocation • Ref : https://en.wikipedia.org/wiki/Slab_allocation
  • 7. Where does REDIS make sense • Handles variety of formats : lists, sets, array • Working with sorted sets in memory. It beats memcached here • collating page clicks analytics data • displaying real-time leaderboard info • High speed data ingest • Message queuing • Session Storage
  • 8. REDIS pros • Works better with a geographically distributed cache, say AWS zones • Pipelining helps in multiple operations on cached datasets at once • Stores data in a variety of formats : sets, lists, sorted sets, bitmaps, hashes, geospatial indices. Atomic ops on these is possible. Eg. Push new elem to list • Blocking reads – will wait till a write completes • Backs data to disk • Partitions data across multiple REDIS instances • Fine-tune cache contents by choosing from 6 eviction policies • Persistent by default, so restarts are better. No cache warmup is needed • Lua scripting
  • 9. REDIS cons • SENTINEL which controls slave-master promotion is unstable. If it fails then failover from slave-master fails • Complex to configure and administer for monitoring, partitioning & balancing • Ref: http://www.bigdatalittlegeek.com/blog/2014/3/25/memcached-vs- redis
  • 10. Where does MEMCACHED make sense • Database queries, reduce read load on databases • Page fragments • REST round trips
  • 11. MEMCACHED pros and cons • PROS • Low complexity, easy to configure, simple to cluster since a hashing algo is used by the client to shard across the cluster • CONS • Is just an in-memory key-value store • Caches sharded by client can’t be distributed across AWS zones • Adding a member to the pool requires a client reconfigure and re-start • Eviction policy is LRU and sometimes the object being evicted is simply the same size as the new one http://www.bogotobogo.com/DevOps/Redis/Redis_vs_Memcached.php • Cache misses happen on a restart
  • 12. MEMCACHED pros and cons • MEMCACHED is supposed to perform better when there are concurrent requests • Eviction policy is better implemented • Depends on: • Type of hardware,Types of data you store • Amount of get and set, App concurrency • Do you need data structure storage
  • 13. A word on clustering Consistent hashing on Memcached is still a more robust model for graceful failure (at least if you are using it as a transient cache) than the Redis sharding. As nodes fall the cache keys automatically move to other servers. As long as you have a single server your cache still operates, albeit poorly. As opposed to redis where, to my understanding, if you lose master and slave for any hashgroup your cluster fails.
  • 14. References • http://www.bigdatalittlegeek.com/blog/2014/3/25/memcached-vs-redis • http://www.bogotobogo.com/DevOps/Redis/Redis_vs_Memcached.php • http://blog.andolasoft.com/2014/02/memcached-vs-redis-which-one-to-pick-for-large-web-app.html • https://www.adayinthelifeof.nl/2011/02/06/memcache-internals/ • http://stackoverflow.com/questions/4188620/redis-and-memcache-or-just-redis?rq=1 • http://stackoverflow.com/questions/7888880/what-is-redis-and-what-do-i-use-it-for?rq=1 • http://stackoverflow.com/questions/10558465/memcached-vs-redis?rq=1 • http://stackoverflow.com/questions/23601622/if-redis-is-already-a-part-of-the-stack-why-is-memcached- still-used-alongside-r?rq=1 • http://stackoverflow.com/questions/10558465/memcached-vs-redis