SlideShare a Scribd company logo
1 of 64
Download to read offline
Cassandra vs. Redis
 NoSQL Frankfurt
 2010-09-28
Who?
• Tim Lossen / @tlossen
• Ruby developer
• Berlin
Challenge
Requirements
• backend for facebook game
Requirements
• backend for facebook game
• 1 mio. daily users
• 10 mio. total users
• 100 KB data per user
Requirements
• peak traffic:
 • 10.000 concurrent users
 • 200.000 requests per minute
Requirements
• peak traffic:
 • 10.000 concurrent users
 • 200.000 requests per minute
• write-heavy workload
Sneak Preview
Cassandra
Overview
• written in Java
 • 55.000 lines of code
Overview
• written in Java
 • 55.000 lines of code
• Thrift API
 • clients for Java, Python, Ruby
History
• originally developed by facebook
 • in production for “inbox search”
History
• originally developed by facebook
 • in production for “inbox search”
• later open sourced
 • top-level apache project
Features
• high availability
 • no single point of failure
Features
• high availability
 • no single point of failure
• incremental scalability
Features
• high availability
 • no single point of failure
• incremental scalability
• eventual consistency
2006
2007
Architecture
• Dynamo-like ring
 • partitioning + replication
 • all nodes are equal
Architecture
• Dynamo-like ring
 • partitioning + replication
 • all nodes are equal
• Bigtable data model
 • column families
Cluster structure
“Cassandra aims to run
on top of an in"astructure
   of hundreds of nodes.”
Redis
Overview
• written in C
 • 13.000 lines of code
Overview
• written in C
 • 13.000 lines of code
• socket API
 • redis-cli
 • client libs for all major languages
Features
• high (write) throughput
 • 50 - 100 K ops / second
Features
• high (write) throughput
 • 50 - 100 K ops / second
• interesting data structures
 • lists, hashes, (sorted) sets
 • atomic operations
Features
• high (write) throughput
 • 50 - 100 K ops / second
• interesting data structures
 • lists, hashes, (sorted) sets
 • atomic operations
• full consistency
Architecture
• single instance (not clustered)
 • master-slave replication
Architecture
• single instance (not clustered)
 • master-slave replication
• in-memory database
 • append-only log on disk
 • virtual memory
“Memory is the new disk,
  disk is the new tape.”
              ⎯ Jim Gray
Solution
Key Decisions
• keep operations simple
Key Decisions
• keep operations simple
• use as few machines as possible
 • ideally, only one
Architecture
• single Redis master
 • with virtual memory
 • handles all reads / writes
Architecture
• single Redis master
 • with virtual memory
 • handles all reads / writes
• single Redis slave
 • as hot standby (for failover)
Throughput
• redis-benchmark
 • 60 K ops / s = 3.6 mio ops / m
Throughput
• redis-benchmark
 • 60 K ops / s = 3.6 mio ops / m
• monitoring (rpm, scout)
 • ca. 10 ops per request
Throughput
• redis-benchmark
 • 60 K ops / s = 3.6 mio ops / m
• monitoring (rpm, scout)
 • ca. 10 ops per request
• 200 K rpm = 2.0 mio ops / m       ✔
Capacity 1
• 100 KB / user (on disk)
• 10.000 concurrent users (peak)
Capacity 1
• 100 KB / user (on disk)
• 10.000 concurrent users (peak)
• 1 GB memory
 • (plus Redis overhead) ✔
Capacity 2
• Redis keeps all keys in memory
• 10 mio. total users
• 20 GB / 100 mio. integer keys
Capacity 2
• Redis keeps all keys in memory
• 10 mio. total users
• 20 GB / 100 mio. integer keys
• 2 GB memory for keys ✔
Data model
• one Redis hash per user
 • key: facebook id
Data model
• one Redis hash per user
 • key: facebook id
• store data as serialized JSON
 • booleans, strings, numbers,
   timestamps ...
Advantages
• efficient to swap user data in / out
Advantages
• efficient to swap user data in / out
• turns Redis into “document db”
 • atomic ops on parts
Advantages
• efficient to swap user data in / out
• turns Redis into “document db”
 • atomic ops on parts
• easy to dump / restore user data
Lessons
“You are not facebook.”
               ⎯ me
Advice
• use the right tool for the job
Advice
• use the right tool for the job
• avoid scaling out / sharding, if
  possible
 • do the numbers!
Advice
• use the right tool for the job
• avoid scaling out / sharding, if
  possible
 • do the numbers!
• keep it simple
Q&A
Links
•cassandra.apache.org
•redis.io


•tim.lossen.de
Cassandra vs. Redis

More Related Content

What's hot

微博cache设计谈
微博cache设计谈微博cache设计谈
微博cache设计谈
Tim Y
 
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Ontico
 
Memory: The New Disk
Memory: The New DiskMemory: The New Disk
Memory: The New Disk
Tim Lossen
 
MongoDB Basic Concepts
MongoDB Basic ConceptsMongoDB Basic Concepts
MongoDB Basic Concepts
MongoDB
 

What's hot (20)

Redis introduction
Redis introductionRedis introduction
Redis introduction
 
MyRocks Deep Dive
MyRocks Deep DiveMyRocks Deep Dive
MyRocks Deep Dive
 
An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL database
 
High Performance Weibo QCon Beijing 2011
High Performance Weibo QCon Beijing 2011High Performance Weibo QCon Beijing 2011
High Performance Weibo QCon Beijing 2011
 
Real time fulltext search with sphinx
Real time fulltext search with sphinxReal time fulltext search with sphinx
Real time fulltext search with sphinx
 
新浪微博开放平台Redis实战
新浪微博开放平台Redis实战新浪微博开放平台Redis实战
新浪微博开放平台Redis实战
 
Realtime Search Infrastructure at Craigslist (OpenWest 2014)
Realtime Search Infrastructure at Craigslist (OpenWest 2014)Realtime Search Infrastructure at Craigslist (OpenWest 2014)
Realtime Search Infrastructure at Craigslist (OpenWest 2014)
 
微博cache设计谈
微博cache设计谈微博cache设计谈
微博cache设计谈
 
Redis 101
Redis 101Redis 101
Redis 101
 
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
 
Memory: The New Disk
Memory: The New DiskMemory: The New Disk
Memory: The New Disk
 
MongoDB Basic Concepts
MongoDB Basic ConceptsMongoDB Basic Concepts
MongoDB Basic Concepts
 
Understanding and tuning WiredTiger, the new high performance database engine...
Understanding and tuning WiredTiger, the new high performance database engine...Understanding and tuning WiredTiger, the new high performance database engine...
Understanding and tuning WiredTiger, the new high performance database engine...
 
Sharding
ShardingSharding
Sharding
 
A New MongoDB Sharding Architecture for Higher Availability and Better Resour...
A New MongoDB Sharding Architecture for Higher Availability and Better Resour...A New MongoDB Sharding Architecture for Higher Availability and Better Resour...
A New MongoDB Sharding Architecture for Higher Availability and Better Resour...
 
M|18 How to use MyRocks with MariaDB Server
M|18 How to use MyRocks with MariaDB ServerM|18 How to use MyRocks with MariaDB Server
M|18 How to use MyRocks with MariaDB Server
 
深入了解Redis
深入了解Redis深入了解Redis
深入了解Redis
 
Sphinx at Craigslist in 2012
Sphinx at Craigslist in 2012Sphinx at Craigslist in 2012
Sphinx at Craigslist in 2012
 
Redis深入浅出
Redis深入浅出Redis深入浅出
Redis深入浅出
 
When is MyRocks good?
When is MyRocks good? When is MyRocks good?
When is MyRocks good?
 

Viewers also liked

Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Dvir Volk
 
Redis sentinelinternals deview
Redis sentinelinternals deviewRedis sentinelinternals deview
Redis sentinelinternals deview
DaeMyung Kang
 

Viewers also liked (20)

Redis/Lessons learned
Redis/Lessons learnedRedis/Lessons learned
Redis/Lessons learned
 
Redis cluster
Redis clusterRedis cluster
Redis cluster
 
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
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Salvatore Sanfilippo – How Redis Cluster works, and why - NoSQL matters Barce...
Salvatore Sanfilippo – How Redis Cluster works, and why - NoSQL matters Barce...Salvatore Sanfilippo – How Redis Cluster works, and why - NoSQL matters Barce...
Salvatore Sanfilippo – How Redis Cluster works, and why - NoSQL matters Barce...
 
Redis in Practice
Redis in PracticeRedis in Practice
Redis in Practice
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
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
 
이것이 레디스다.
이것이 레디스다.이것이 레디스다.
이것이 레디스다.
 
Redes informaticas
Redes informaticasRedes informaticas
Redes informaticas
 
Tarantool 1.6 talk at SECR 2014 conference
Tarantool 1.6 talk at SECR 2014 conferenceTarantool 1.6 talk at SECR 2014 conference
Tarantool 1.6 talk at SECR 2014 conference
 
Works with persistent graphs using OrientDB
Works with persistent graphs using OrientDB Works with persistent graphs using OrientDB
Works with persistent graphs using OrientDB
 
Intro to apache spark stand ford
Intro to apache spark stand fordIntro to apache spark stand ford
Intro to apache spark stand ford
 
Paris Redis Meetup Introduction
Paris Redis Meetup IntroductionParis Redis Meetup Introduction
Paris Redis Meetup Introduction
 
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarJava programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswar
 
Mongo db 2.x to 3.x
Mongo db 2.x to 3.xMongo db 2.x to 3.x
Mongo db 2.x to 3.x
 
Redis sentinelinternals deview
Redis sentinelinternals deviewRedis sentinelinternals deview
Redis sentinelinternals deview
 
Redis -- Memory as the New Disk
Redis -- Memory as the New DiskRedis -- Memory as the New Disk
Redis -- Memory as the New Disk
 
Tokyo Cassandra Summit 2014: Tunable Consistency by Al Tobey
Tokyo Cassandra Summit 2014: Tunable Consistency by Al TobeyTokyo Cassandra Summit 2014: Tunable Consistency by Al Tobey
Tokyo Cassandra Summit 2014: Tunable Consistency by Al Tobey
 
Redis acc 2015
Redis acc 2015Redis acc 2015
Redis acc 2015
 

Similar to Cassandra vs. Redis

My Sql And Search At Craigslist
My Sql And Search At CraigslistMy Sql And Search At Craigslist
My Sql And Search At Craigslist
MySQLConference
 
Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...
Alluxio, Inc.
 
MongoDB Administration 20110922
MongoDB Administration 20110922MongoDB Administration 20110922
MongoDB Administration 20110922
radiocats
 

Similar to Cassandra vs. Redis (20)

Drop acid
Drop acidDrop acid
Drop acid
 
Scaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQLScaling the Web: Databases & NoSQL
Scaling the Web: Databases & NoSQL
 
Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)Using Spring with NoSQL databases (SpringOne China 2012)
Using Spring with NoSQL databases (SpringOne China 2012)
 
My Sql And Search At Craigslist
My Sql And Search At CraigslistMy Sql And Search At Craigslist
My Sql And Search At Craigslist
 
Mongodb my
Mongodb myMongodb my
Mongodb my
 
MongoDB
MongoDBMongoDB
MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 
Storage Engine Wars at Parse
Storage Engine Wars at ParseStorage Engine Wars at Parse
Storage Engine Wars at Parse
 
Mongo db admin_20110329
Mongo db admin_20110329Mongo db admin_20110329
Mongo db admin_20110329
 
How does Apache Pegasus (incubating) community develop at SensorsData
How does Apache Pegasus (incubating) community develop at SensorsDataHow does Apache Pegasus (incubating) community develop at SensorsData
How does Apache Pegasus (incubating) community develop at SensorsData
 
Wmware NoSQL
Wmware NoSQLWmware NoSQL
Wmware NoSQL
 
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
Select Stars: A DBA's Guide to Azure Cosmos DB (SQL Saturday Oslo 2018)
 
Cosmos db
Cosmos dbCosmos db
Cosmos db
 
MongoDB SF Ruby
MongoDB SF RubyMongoDB SF Ruby
MongoDB SF Ruby
 
Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...
 
Agility and Scalability with MongoDB
Agility and Scalability with MongoDBAgility and Scalability with MongoDB
Agility and Scalability with MongoDB
 
ActiveMQ 5.9.x new features
ActiveMQ 5.9.x new featuresActiveMQ 5.9.x new features
ActiveMQ 5.9.x new features
 
MariaDB 10: The Complete Tutorial
MariaDB 10: The Complete TutorialMariaDB 10: The Complete Tutorial
MariaDB 10: The Complete Tutorial
 
MongoDB Administration 20110922
MongoDB Administration 20110922MongoDB Administration 20110922
MongoDB Administration 20110922
 
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag Jambhekar
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag JambhekarC* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag Jambhekar
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag Jambhekar
 

More from Tim Lossen

Redis to the Rescue?
Redis to the Rescue?Redis to the Rescue?
Redis to the Rescue?
Tim Lossen
 
Announcing Euruko 2011
Announcing Euruko 2011Announcing Euruko 2011
Announcing Euruko 2011
Tim Lossen
 
An Introduction to Membase
An Introduction to MembaseAn Introduction to Membase
An Introduction to Membase
Tim Lossen
 

More from Tim Lossen (20)

Apocalypse Later
Apocalypse LaterApocalypse Later
Apocalypse Later
 
Embracing Failure
Embracing FailureEmbracing Failure
Embracing Failure
 
Embracing Failure
Embracing FailureEmbracing Failure
Embracing Failure
 
Enemy of the State?
Enemy of the State?Enemy of the State?
Enemy of the State?
 
Beyond Devops
Beyond DevopsBeyond Devops
Beyond Devops
 
All Your Core Are Belong To Us
All Your Core Are Belong To UsAll Your Core Are Belong To Us
All Your Core Are Belong To Us
 
Podularity FTW!
Podularity FTW!Podularity FTW!
Podularity FTW!
 
Cubic Foot Gardening
Cubic Foot GardeningCubic Foot Gardening
Cubic Foot Gardening
 
Dashboard Mania
Dashboard ManiaDashboard Mania
Dashboard Mania
 
Event-Stream Processing with Kafka
Event-Stream Processing with KafkaEvent-Stream Processing with Kafka
Event-Stream Processing with Kafka
 
Into the Void
Into the VoidInto the Void
Into the Void
 
Treasure Island -- Concurrency in JRuby
Treasure Island -- Concurrency in JRubyTreasure Island -- Concurrency in JRuby
Treasure Island -- Concurrency in JRuby
 
Dashboard Mania
Dashboard ManiaDashboard Mania
Dashboard Mania
 
JRuby vs. Rubinius
JRuby vs. RubiniusJRuby vs. Rubinius
JRuby vs. Rubinius
 
Redis to the Rescue?
Redis to the Rescue?Redis to the Rescue?
Redis to the Rescue?
 
Redis to the Rescue?
Redis to the Rescue?Redis to the Rescue?
Redis to the Rescue?
 
The Smallest Cluster in the World
The Smallest Cluster in the WorldThe Smallest Cluster in the World
The Smallest Cluster in the World
 
Announcing Euruko 2011
Announcing Euruko 2011Announcing Euruko 2011
Announcing Euruko 2011
 
An Introduction to Membase
An Introduction to MembaseAn Introduction to Membase
An Introduction to Membase
 
Petascale Storage -- Do It Yourself!
Petascale Storage -- Do It Yourself!Petascale Storage -- Do It Yourself!
Petascale Storage -- Do It Yourself!
 

Recently uploaded

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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

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
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
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
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
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...
 
[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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 

Cassandra vs. Redis