SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Redis in Practice
Redis in PracticeRedis in Practice
Redis in Practice
 
An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL database
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
Redis database
Redis databaseRedis database
Redis database
 
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 cluster
Redis clusterRedis cluster
Redis cluster
 
Introduction to redis - version 2
Introduction to redis - version 2Introduction to redis - version 2
Introduction to redis - version 2
 
Redis persistence in practice
Redis persistence in practiceRedis persistence in practice
Redis persistence in practice
 
Redis Overview
Redis OverviewRedis Overview
Redis Overview
 
Redis
RedisRedis
Redis
 
Redis Persistence
Redis  PersistenceRedis  Persistence
Redis Persistence
 
REDIS intro and how to use redis
REDIS intro and how to use redisREDIS intro and how to use redis
REDIS intro and how to use redis
 
Redis and it's data types
Redis and it's data typesRedis and it's data types
Redis and it's data types
 
Memcached Presentation
Memcached PresentationMemcached Presentation
Memcached Presentation
 
Redis - Usability and Use Cases
Redis - Usability and Use CasesRedis - Usability and Use Cases
Redis - Usability and Use Cases
 
Securing Hadoop with Apache Ranger
Securing Hadoop with Apache RangerSecuring Hadoop with Apache Ranger
Securing Hadoop with Apache Ranger
 
Paris Redis Meetup Introduction
Paris Redis Meetup IntroductionParis Redis Meetup Introduction
Paris Redis Meetup Introduction
 
Apache Ranger
Apache RangerApache Ranger
Apache Ranger
 
RedisConf17- Using Redis at scale @ Twitter
RedisConf17- Using Redis at scale @ TwitterRedisConf17- Using Redis at scale @ Twitter
RedisConf17- Using Redis at scale @ Twitter
 

Destacado

Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Dvir Volk
 
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
 

Destacado (20)

REDIS caching explained
REDIS caching explained REDIS caching explained
REDIS caching explained
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Redis Labs and SQL Server
Redis Labs and SQL ServerRedis Labs and SQL Server
Redis Labs and SQL Server
 
Redis 101
Redis 101Redis 101
Redis 101
 
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
 

Similar a Caching solutions with Redis

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

Similar a 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
 
The NoSQL Ecosystem
The NoSQL Ecosystem The NoSQL Ecosystem
The NoSQL Ecosystem
 
HPTS 2011: The NoSQL Ecosystem
HPTS 2011: The NoSQL EcosystemHPTS 2011: The NoSQL Ecosystem
HPTS 2011: 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
 
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.
 
Ceph and RocksDB
Ceph and RocksDBCeph and RocksDB
Ceph and RocksDB
 
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
 

Más 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
 

Último

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
+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@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
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)

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
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
"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 ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
+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...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

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