SlideShare a Scribd company logo
1 of 53
Download to read offline
Memory:
The New Disk
Beuth Hochschule für Technik
2010-11-09
Who?
• Tim Lossen / @tlossen
• Ruby developer
• backend developer at ....
Challenge
Requirements
• backend for facebook game
Requirements
• backend for facebook game
• 1 mio. daily users
• 100 KB data per user
Requirements
• peak traffic:
- 10.000 concurrent users
- 3.000 requests/second
Requirements
• peak traffic:
- 10.000 concurrent users
- 3.000 requests/second
• write-heavy workload
Relational
Database
Scaling Reads
• caching (memcached)
Scaling Reads
• caching (memcached)
• read-only slaves
- horizontal scaling
Scaling Reads
• caching (memcached)
• read-only slaves
- horizontal scaling
• easy
Scaling Writes
• limit: 1000 writes/second on EC2
Scaling Writes
• limit: 1000 writes/second on EC2
• sharding
- split database into parts
Scaling Writes
• limit: 1000 writes/second on EC2
• sharding
- split database into parts
• difficult
Alternatives?
Alternatives?
Cassandra
CouchDB
MongoDB
Redis
Riak
Membase
BigTable
SimpleDB
Hypertable
Basics
Relative Latency
Memory 1
SSD
Disk
Relative Latency
Memory 1
SSD 1000
Disk
x 1000
Relative Latency
Memory 1
SSD 1000
Disk 100 000
x 1000
x 100
Pizza Delivery Time
Memory 30 minutes
SSD 3 weeks
Disk 5.5 years
x 1000
x 100
“Memory is the new disk,
disk is the new tape.”
— Jim Gray
Rule of thumb
• random access = memory
• sequential access = disk
Euro per GB
Memory 20
SSD 2
Disk 0.05
÷ 10
÷ 40
Redis
Architecture
• key-value-store
• in-memory database
- with virtual memory
Durability
• full database dumps
Durability
• full database dumps
• append-only log
Killer Feature
• high (write) throughput
- 30 to 150 K operations / second
Other Features
• interesting data structures
- lists, hashes, (sorted) sets
- atomic operations
Our Setup
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 req / m = 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
Advice
Advice
• use the right tool for the job
Advice
• use the right tool for the job
• avoid sharding
- as long as possible
Advice
• use the right tool for the job
• avoid sharding
- as long as possible
• keep it simple
Q & A
Nosql Night Berlin
November 17, 19:30
newthinking store
Tucholskystr. 48
Links
• "A Conversation with Jim Gray"
•redis.io
•tim.lossen.de
•wooga.com/jobs

More Related Content

What's hot

Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...
Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...
Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...
Ontico
 
Key-Value-Stores -- The Key to Scaling?
Key-Value-Stores -- The Key to Scaling?Key-Value-Stores -- The Key to Scaling?
Key-Value-Stores -- The Key to Scaling?
Tim Lossen
 
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Ontico
 
MongoDB Memory Management Demystified
MongoDB Memory Management DemystifiedMongoDB Memory Management Demystified
MongoDB Memory Management Demystified
MongoDB
 

What's hot (20)

Living with SQL and NoSQL at craigslist, a Pragmatic Approach
Living with SQL and NoSQL at craigslist, a Pragmatic ApproachLiving with SQL and NoSQL at craigslist, a Pragmatic Approach
Living with SQL and NoSQL at craigslist, a Pragmatic Approach
 
Sphinx at Craigslist in 2012
Sphinx at Craigslist in 2012Sphinx at Craigslist in 2012
Sphinx at Craigslist in 2012
 
MongoDB
MongoDBMongoDB
MongoDB
 
How to migrate your existing MongoDB and Cassandra Apps to Azure Cosmos DB
How to migrate your existing MongoDB and Cassandra Apps to Azure Cosmos DBHow to migrate your existing MongoDB and Cassandra Apps to Azure Cosmos DB
How to migrate your existing MongoDB and Cassandra Apps to Azure Cosmos DB
 
Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...
Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...
Tarantool: как сэкономить миллион долларов на базе данных на высоконагруженно...
 
深入了解Redis
深入了解Redis深入了解Redis
深入了解Redis
 
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
 
A simple introduction to redis
A simple introduction to redisA simple introduction to redis
A simple introduction to redis
 
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...
 
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...
 
Key-Value-Stores -- The Key to Scaling?
Key-Value-Stores -- The Key to Scaling?Key-Value-Stores -- The Key to Scaling?
Key-Value-Stores -- The Key to Scaling?
 
Redis overview for Software Architecture Forum
Redis overview for Software Architecture ForumRedis overview for Software Architecture Forum
Redis overview for Software Architecture Forum
 
Redis深入浅出
Redis深入浅出Redis深入浅出
Redis深入浅出
 
MySQL And Search At Craigslist
MySQL And Search At CraigslistMySQL And Search At Craigslist
MySQL And Search At Craigslist
 
Fusion-io and MySQL at Craigslist
Fusion-io and MySQL at CraigslistFusion-io and MySQL at Craigslist
Fusion-io and MySQL at Craigslist
 
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...Frontera распределенный робот для обхода веба в больших объемах / Александр С...
Frontera распределенный робот для обхода веба в больших объемах / Александр С...
 
MongoDB Memory Management Demystified
MongoDB Memory Management DemystifiedMongoDB Memory Management Demystified
MongoDB Memory Management Demystified
 
This is redis - feature and usecase
This is redis - feature and usecaseThis is redis - feature and usecase
This is redis - feature and usecase
 
MyRocks Deep Dive
MyRocks Deep DiveMyRocks Deep Dive
MyRocks Deep Dive
 
Mongodb backup
Mongodb backupMongodb backup
Mongodb backup
 

Viewers also liked

Viewers also liked (6)

Social Media & CPAs NYSSCPA
Social Media & CPAs  NYSSCPASocial Media & CPAs  NYSSCPA
Social Media & CPAs NYSSCPA
 
We were promised Xanadu
We were promised XanaduWe were promised Xanadu
We were promised Xanadu
 
Wzrost konwersji dzieki segmentacji i targetowaniu
Wzrost konwersji dzieki segmentacji i targetowaniuWzrost konwersji dzieki segmentacji i targetowaniu
Wzrost konwersji dzieki segmentacji i targetowaniu
 
Bynet2.3 Microsoft. Mediacontent delivery using IIS7 and Silverlight3
Bynet2.3 Microsoft. Mediacontent delivery using IIS7 and Silverlight3Bynet2.3 Microsoft. Mediacontent delivery using IIS7 and Silverlight3
Bynet2.3 Microsoft. Mediacontent delivery using IIS7 and Silverlight3
 
Bolos de casamento no Kuwait
Bolos de casamento no  KuwaitBolos de casamento no  Kuwait
Bolos de casamento no Kuwait
 
MACPA PIU - Spring 2011
MACPA PIU - Spring 2011MACPA PIU - Spring 2011
MACPA PIU - Spring 2011
 

Similar to Memory: The New Disk

M6d cassandrapresentation
M6d cassandrapresentationM6d cassandrapresentation
M6d cassandrapresentation
Edward Capriolo
 
Scaling HDFS to Manage Billions of Files with Key-Value Stores
Scaling HDFS to Manage Billions of Files with Key-Value StoresScaling HDFS to Manage Billions of Files with Key-Value Stores
Scaling HDFS to Manage Billions of Files with Key-Value Stores
DataWorks Summit
 
Deployment Strategy
Deployment StrategyDeployment Strategy
Deployment Strategy
MongoDB
 

Similar to Memory: The New Disk (20)

Cosmos db
Cosmos dbCosmos db
Cosmos db
 
Agility and Scalability with MongoDB
Agility and Scalability with MongoDBAgility and Scalability with MongoDB
Agility and Scalability with MongoDB
 
M6d cassandrapresentation
M6d cassandrapresentationM6d cassandrapresentation
M6d cassandrapresentation
 
Sharding Methods for MongoDB
Sharding Methods for MongoDBSharding Methods for MongoDB
Sharding Methods for MongoDB
 
Storage Engine Wars at Parse
Storage Engine Wars at ParseStorage Engine Wars at Parse
Storage Engine Wars at Parse
 
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)
 
Scaling HDFS to Manage Billions of Files
Scaling HDFS to Manage Billions of FilesScaling HDFS to Manage Billions of Files
Scaling HDFS to Manage Billions of Files
 
Scaling HDFS to Manage Billions of Files with Key-Value Stores
Scaling HDFS to Manage Billions of Files with Key-Value StoresScaling HDFS to Manage Billions of Files with Key-Value Stores
Scaling HDFS to Manage Billions of Files with Key-Value Stores
 
«Scrapy internals» Александр Сибиряков, Scrapinghub
«Scrapy internals» Александр Сибиряков, Scrapinghub«Scrapy internals» Александр Сибиряков, Scrapinghub
«Scrapy internals» Александр Сибиряков, Scrapinghub
 
Frontera: open source, large scale web crawling framework
Frontera: open source, large scale web crawling frameworkFrontera: open source, large scale web crawling framework
Frontera: open source, large scale web crawling framework
 
Drop acid
Drop acidDrop acid
Drop acid
 
Kinetic basho public
Kinetic basho publicKinetic basho public
Kinetic basho public
 
Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...
Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...
Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...
 
Alexander Sibiryakov- Frontera
Alexander Sibiryakov- FronteraAlexander Sibiryakov- Frontera
Alexander Sibiryakov- Frontera
 
Wmware NoSQL
Wmware NoSQLWmware NoSQL
Wmware NoSQL
 
Deployment Strategy
Deployment StrategyDeployment Strategy
Deployment Strategy
 
Compare DynamoDB vs. MongoDB
Compare DynamoDB vs. MongoDBCompare DynamoDB vs. MongoDB
Compare DynamoDB vs. MongoDB
 
Dynamo vs Mongo
Dynamo vs MongoDynamo vs Mongo
Dynamo vs Mongo
 
Deployment Strategies
Deployment StrategiesDeployment Strategies
Deployment Strategies
 
KeyValue Stores
KeyValue StoresKeyValue Stores
KeyValue Stores
 

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

+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
 
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
 
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
 

Recently uploaded (20)

Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
+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...
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data PlatformLess Is More: Utilizing Ballerina to Architect a Cloud Data Platform
Less Is More: Utilizing Ballerina to Architect a Cloud Data Platform
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
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
 
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
 
Modernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using BallerinaModernizing Legacy Systems Using Ballerina
Modernizing Legacy Systems Using Ballerina
 
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...
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...Stronger Together: Developing an Organizational Strategy for Accessible Desig...
Stronger Together: Developing an Organizational Strategy for Accessible Desig...
 
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
 

Memory: The New Disk