SlideShare une entreprise Scribd logo
1  sur  14
Caching Solutions:
Redis
with Bogdan Hadadea
1. General Description: Redis
•
•
•
•

NoSQL key-value date store
Like MongoDB, but better
Built-in persistence
More data types
o
o
o
o

String
Hash
Set
List

• Built-in pub/sub feature
• Highly scalable
1. General Description: Redis
•
•
•
•
•
•
•

Creator: Salvatore Sanfilippo
Released: 2009
Written in ANSI C
Single threaded
Open Source
Backed by VMWare
Early adopted by GitHub
2. Usage: Redis – Who?
• StackOverflow – 3 layers of caching
o Local cache
o Site cache
o Global cache

• Blizzard – 8 node Redis install
o 16GB/instance
o For storing auction house and serving avatars

• Amazon ElastiCache, Redis-to-go
o Cache in the cloud
o Cache hosting
2. Usage: Redis – What for?
• Redis for cache
o Good to place sessions – hashes
o A fine place for high score tracking – sorted sets

• Redis as database
o Persistence to disk
o High performance

• Redis as message bus
o Based on Pub/Sub functionality
o Queues with list structures
o Resque – Ruby library for creating background jobs
3. Architecture: Redis – Overview
3. Architecture: Redis
• Request/Response Protocols:
o Redis is a TCP server using the client-server model
Request/Response protocol

• Pipelining:
o Process multiple requests even if response not read yet
o Not paying the RTT (Round Trip Time) for every command

• Limitations:
o Responses stored in a queue
o Recommended max: 10k commands

• Benchmark: ‘Ping’ – 10k times
3. Architecture: Redis
• Scripting
o
o
o
o

Lua interpreter built in ver. > 2.6
Using EVAL and EVALSHA
Conversion between Lua and Redis data types
redis.call() & redis.pcall()

o Atomicity of scripts
o Emitting Redis logs from scripts
o EVALSHA in the context of pipelining
3. Architecture: Redis
• Replication:
o
o
o
o
o
o
o
o
o
o
o
o
o

Master-slave: exact copies
Asynchronous replication
Master – multiple slaves
Non-blocking replication – master side
Non-blocking replication – slave side – old dataset
Slaves accept connections from other slaves
Replication for scalability
Replication for cost saving
Full/Partial synchronization
Configure: slaveof 192.168.1.1 6379
Read-only slaves
Slave authentication to master
Write only when N replicas
3. Architecture: Redis
• Redis Transactions:
o No rollback
o Optimistic locking
3. Architecture: Redis
• Publisher/Subscriber messaging paradigm
o Decoupling pub-sub
o Pattern matching subscriptions

• Redis clustering
o Not production ready

• Memory optimization
o Encoding of small data – up to 5x less space
o Using 32bit instances

• Using hashes to abstract a key-value on top of Redis
4. Comparison: Memcached
4. Comparison: Memcached
5. Conclusion
•
•
•
•

Focused on speed
Reliable as database
Steeper learning curve than other solutions
Still improving

Contenu connexe

Tendances

Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Dvir Volk
 
Introduction to NoSQL Databases
Introduction to NoSQL DatabasesIntroduction to NoSQL Databases
Introduction to NoSQL Databases
Derek Stainer
 

Tendances (20)

An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL database
 
An Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdfAn Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdf
 
A simple introduction to redis
A simple introduction to redisA simple introduction to redis
A simple introduction to redis
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
redis basics
redis basicsredis basics
redis basics
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial
 
Redis - Usability and Use Cases
Redis - Usability and Use CasesRedis - Usability and Use Cases
Redis - Usability and Use Cases
 
Redis database
Redis databaseRedis database
Redis database
 
Redis Persistence
Redis  PersistenceRedis  Persistence
Redis Persistence
 
Introduction to NoSQL Databases
Introduction to NoSQL DatabasesIntroduction to NoSQL Databases
Introduction to NoSQL Databases
 
Redis and it's data types
Redis and it's data typesRedis and it's data types
Redis and it's data types
 
Redis Overview
Redis OverviewRedis Overview
Redis Overview
 
MongoDB Fundamentals
MongoDB FundamentalsMongoDB Fundamentals
MongoDB Fundamentals
 
Paris Redis Meetup Introduction
Paris Redis Meetup IntroductionParis Redis Meetup Introduction
Paris Redis Meetup Introduction
 
Redis in Practice
Redis in PracticeRedis in Practice
Redis in Practice
 
Redis persistence in practice
Redis persistence in practiceRedis persistence in practice
Redis persistence in practice
 
Troubleshooting redis
Troubleshooting redisTroubleshooting redis
Troubleshooting redis
 
High-Volume Data Collection and Real Time Analytics Using Redis
High-Volume Data Collection and Real Time Analytics Using RedisHigh-Volume Data Collection and Real Time Analytics Using Redis
High-Volume Data Collection and Real Time Analytics Using Redis
 

En vedette

Jug Lugano - Scale over the limits
Jug Lugano - Scale over the limitsJug Lugano - Scale over the limits
Jug Lugano - Scale over the limits
Davide Carnevali
 
Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redis
Dvir Volk
 

En vedette (18)

REDIS caching explained
REDIS caching explained REDIS caching explained
REDIS caching explained
 
Redis Labs and SQL Server
Redis Labs and SQL ServerRedis Labs and SQL Server
Redis Labs and SQL Server
 
Highly scalable caching service on cloud - Redis
Highly scalable caching service on cloud - RedisHighly scalable caching service on cloud - Redis
Highly scalable caching service on cloud - Redis
 
Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askEverything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to ask
 
Jug Lugano - Scale over the limits
Jug Lugano - Scale over the limitsJug Lugano - Scale over the limits
Jug Lugano - Scale over the limits
 
Cache Money Business
Cache Money BusinessCache Money Business
Cache Money Business
 
Distributed caching with java JCache
Distributed caching with java JCacheDistributed caching with java JCache
Distributed caching with java JCache
 
Caching Strategies
Caching StrategiesCaching Strategies
Caching Strategies
 
More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)
 
Redis and its many use cases
Redis and its many use casesRedis and its many use cases
Redis and its many use cases
 
Managing 50K+ Redis Databases Over 4 Public Clouds ... with a Tiny Devops Team
Managing 50K+ Redis Databases Over 4 Public Clouds ... with a Tiny Devops TeamManaging 50K+ Redis Databases Over 4 Public Clouds ... with a Tiny Devops Team
Managing 50K+ Redis Databases Over 4 Public Clouds ... with a Tiny Devops Team
 
Redis data design by usecase
Redis data design by usecaseRedis data design by usecase
Redis data design by usecase
 
Redis for the Everyday Developer
Redis for the Everyday DeveloperRedis for the Everyday Developer
Redis for the Everyday Developer
 
Kicking ass with redis
Kicking ass with redisKicking ass with redis
Kicking ass with redis
 
No data loss pipeline with apache kafka
No data loss pipeline with apache kafkaNo data loss pipeline with apache kafka
No data loss pipeline with apache kafka
 
Building Modern Applications Using APIs, Microservices and Chatbots
Building Modern Applications Using APIs, Microservices and ChatbotsBuilding Modern Applications Using APIs, Microservices and Chatbots
Building Modern Applications Using APIs, Microservices and Chatbots
 
MongoDB as a fast and queryable cache
MongoDB as a fast and queryable cacheMongoDB as a fast and queryable cache
MongoDB as a fast and queryable cache
 
Oracle Code Keynote with Thomas Kurian
Oracle Code Keynote with Thomas KurianOracle Code Keynote with Thomas Kurian
Oracle Code Keynote with Thomas Kurian
 

Similaire à Caching solutions with Redis

Scaling CouchDB with BigCouch
Scaling CouchDB with BigCouchScaling CouchDB with BigCouch
Scaling CouchDB with BigCouch
Cloudant
 

Similaire à Caching solutions with Redis (20)

MongoDB Replication fundamentals - Desert Code Camp - October 2014
MongoDB Replication fundamentals - Desert Code Camp - October 2014MongoDB Replication fundamentals - Desert Code Camp - October 2014
MongoDB Replication fundamentals - Desert Code Camp - October 2014
 
MongoDB Replication fundamentals - Desert Code Camp - October 2014
MongoDB Replication fundamentals - Desert Code Camp - October 2014MongoDB Replication fundamentals - Desert Code Camp - October 2014
MongoDB Replication fundamentals - Desert Code Camp - October 2014
 
Training Slides: Basics 103: The Power of Tungsten Connector / Proxy
Training Slides: Basics 103: The Power of Tungsten Connector / ProxyTraining Slides: Basics 103: The Power of Tungsten Connector / Proxy
Training Slides: Basics 103: The Power of Tungsten Connector / Proxy
 
KeyValue Stores
KeyValue StoresKeyValue Stores
KeyValue Stores
 
Spring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_dataSpring one2gx2010 spring-nonrelational_data
Spring one2gx2010 spring-nonrelational_data
 
Red Hat Storage Server Administration Deep Dive
Red Hat Storage Server Administration Deep DiveRed Hat Storage Server Administration Deep Dive
Red Hat Storage Server Administration Deep Dive
 
HPTS 2011: The NoSQL Ecosystem
HPTS 2011: The NoSQL EcosystemHPTS 2011: The NoSQL Ecosystem
HPTS 2011: The NoSQL Ecosystem
 
The NoSQL Ecosystem
The NoSQL Ecosystem The NoSQL Ecosystem
The NoSQL Ecosystem
 
Ippevent : openshift Introduction
Ippevent : openshift IntroductionIppevent : openshift Introduction
Ippevent : openshift Introduction
 
Cassandra for mission critical data
Cassandra for mission critical dataCassandra for mission critical data
Cassandra for mission critical data
 
Drop acid
Drop acidDrop acid
Drop acid
 
Building a distributed Key-Value store with Cassandra
Building a distributed Key-Value store with CassandraBuilding a distributed Key-Value store with Cassandra
Building a distributed Key-Value store with Cassandra
 
Crimson: Ceph for the Age of NVMe and Persistent Memory
Crimson: Ceph for the Age of NVMe and Persistent MemoryCrimson: Ceph for the Age of NVMe and Persistent Memory
Crimson: Ceph for the Age of NVMe and Persistent Memory
 
Your 1st Ceph cluster
Your 1st Ceph clusterYour 1st Ceph cluster
Your 1st Ceph cluster
 
What's new in Jewel and Beyond
What's new in Jewel and BeyondWhat's new in Jewel and Beyond
What's new in Jewel and Beyond
 
Scaling CouchDB with BigCouch
Scaling CouchDB with BigCouchScaling CouchDB with BigCouch
Scaling CouchDB with BigCouch
 
Redis by-hari
Redis by-hariRedis by-hari
Redis by-hari
 
Ceph and RocksDB
Ceph and RocksDBCeph and RocksDB
Ceph and RocksDB
 
The Hive Think Tank: Ceph + RocksDB by Sage Weil, Red Hat.
The Hive Think Tank: Ceph + RocksDB by Sage Weil, Red Hat.The Hive Think Tank: Ceph + RocksDB by Sage Weil, Red Hat.
The Hive Think Tank: Ceph + RocksDB by Sage Weil, Red Hat.
 
Quick-and-Easy Deployment of a Ceph Storage Cluster
Quick-and-Easy Deployment of a Ceph Storage ClusterQuick-and-Easy Deployment of a Ceph Storage Cluster
Quick-and-Easy Deployment of a Ceph Storage Cluster
 

Plus de George Platon (6)

Building strategies for success in startup ecosystem
Building strategies for success in startup ecosystemBuilding strategies for success in startup ecosystem
Building strategies for success in startup ecosystem
 
Open coffee tech 2nd meetup
Open coffee tech 2nd meetup Open coffee tech 2nd meetup
Open coffee tech 2nd meetup
 
Caching solutions with Varnish
Caching solutions  with VarnishCaching solutions  with Varnish
Caching solutions with Varnish
 
Open coffee planning
Open coffee planningOpen coffee planning
Open coffee planning
 
Open coffee planning
Open coffee planningOpen coffee planning
Open coffee planning
 
Magic with groovy & grails
Magic with groovy & grailsMagic with groovy & grails
Magic with groovy & grails
 

Dernier

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Dernier (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

Caching solutions with Redis

  • 2. 1. General Description: Redis • • • • NoSQL key-value date store Like MongoDB, but better Built-in persistence More data types o o o o String Hash Set List • Built-in pub/sub feature • Highly scalable
  • 3. 1. General Description: Redis • • • • • • • Creator: Salvatore Sanfilippo Released: 2009 Written in ANSI C Single threaded Open Source Backed by VMWare Early adopted by GitHub
  • 4. 2. Usage: Redis – Who? • StackOverflow – 3 layers of caching o Local cache o Site cache o Global cache • Blizzard – 8 node Redis install o 16GB/instance o For storing auction house and serving avatars • Amazon ElastiCache, Redis-to-go o Cache in the cloud o Cache hosting
  • 5. 2. Usage: Redis – What for? • Redis for cache o Good to place sessions – hashes o A fine place for high score tracking – sorted sets • Redis as database o Persistence to disk o High performance • Redis as message bus o Based on Pub/Sub functionality o Queues with list structures o Resque – Ruby library for creating background jobs
  • 6. 3. Architecture: Redis – Overview
  • 7. 3. Architecture: Redis • Request/Response Protocols: o Redis is a TCP server using the client-server model Request/Response protocol • Pipelining: o Process multiple requests even if response not read yet o Not paying the RTT (Round Trip Time) for every command • Limitations: o Responses stored in a queue o Recommended max: 10k commands • Benchmark: ‘Ping’ – 10k times
  • 8. 3. Architecture: Redis • Scripting o o o o Lua interpreter built in ver. > 2.6 Using EVAL and EVALSHA Conversion between Lua and Redis data types redis.call() & redis.pcall() o Atomicity of scripts o Emitting Redis logs from scripts o EVALSHA in the context of pipelining
  • 9. 3. Architecture: Redis • Replication: o o o o o o o o o o o o o Master-slave: exact copies Asynchronous replication Master – multiple slaves Non-blocking replication – master side Non-blocking replication – slave side – old dataset Slaves accept connections from other slaves Replication for scalability Replication for cost saving Full/Partial synchronization Configure: slaveof 192.168.1.1 6379 Read-only slaves Slave authentication to master Write only when N replicas
  • 10. 3. Architecture: Redis • Redis Transactions: o No rollback o Optimistic locking
  • 11. 3. Architecture: Redis • Publisher/Subscriber messaging paradigm o Decoupling pub-sub o Pattern matching subscriptions • Redis clustering o Not production ready • Memory optimization o Encoding of small data – up to 5x less space o Using 32bit instances • Using hashes to abstract a key-value on top of Redis
  • 14. 5. Conclusion • • • • Focused on speed Reliable as database Steeper learning curve than other solutions Still improving