Enviar búsqueda
Cargar
Redis to the Rescue?
•
40 recomendaciones
•
3,992 vistas
Tim Lossen
Seguir
O'Reilly MySQL Conference 2011, Santa Clara
Leer menos
Leer más
Tecnología
Denunciar
Compartir
Denunciar
Compartir
1 de 76
Descargar ahora
Descargar para leer sin conexión
Recomendados
Redis to the Rescue?
Redis to the Rescue?
Tim Lossen
Facilitando a Programação concorrente com o Fork/Join
Facilitando a Programação concorrente com o Fork/Join
Mario Amaral
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
Daniel Cousineau
MongoDB Performance Tuning
MongoDB Performance Tuning
MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDB
MongoDB
Json tutorial, a beguiner guide
Json tutorial, a beguiner guide
Rafael Montesinos Muñoz
Talk about ReactiveMongo at MSUG May
Talk about ReactiveMongo at MSUG May
Andrey Neverov
MySQL Without The SQL -- Oh My! PHP Detroit July 2018
MySQL Without The SQL -- Oh My! PHP Detroit July 2018
Dave Stokes
Recomendados
Redis to the Rescue?
Redis to the Rescue?
Tim Lossen
Facilitando a Programação concorrente com o Fork/Join
Facilitando a Programação concorrente com o Fork/Join
Mario Amaral
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
Daniel Cousineau
MongoDB Performance Tuning
MongoDB Performance Tuning
MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDB
Mythbusting: Understanding How We Measure the Performance of MongoDB
MongoDB
Json tutorial, a beguiner guide
Json tutorial, a beguiner guide
Rafael Montesinos Muñoz
Talk about ReactiveMongo at MSUG May
Talk about ReactiveMongo at MSUG May
Andrey Neverov
MySQL Without The SQL -- Oh My! PHP Detroit July 2018
MySQL Without The SQL -- Oh My! PHP Detroit July 2018
Dave Stokes
MongoDB at GUL
MongoDB at GUL
Israel Gutiérrez
Building Apps with MongoDB
Building Apps with MongoDB
Nate Abele
Building a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and Java
antoinegirbal
Pinterest的数据库分片架构
Pinterest的数据库分片架构
Tommy Chiu
Operational Intelligence with MongoDB Webinar
Operational Intelligence with MongoDB Webinar
MongoDB
MongoDB @ Frankfurt NoSql User Group
MongoDB @ Frankfurt NoSql User Group
Chris Harris
Become a Java GC Hero - All Day Devops
Become a Java GC Hero - All Day Devops
Tier1app
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
MongoDB
Nested and Parent/Child Docs in ElasticSearch
Nested and Parent/Child Docs in ElasticSearch
BeyondTrees
Introduction to Scala for Java Programmers
Introduction to Scala for Java Programmers
sbjug
Scala for the doubters
Scala for the doubters
Max Klyga
Introduction to MongoDB
Introduction to MongoDB
antoinegirbal
Apocalypse Later
Apocalypse Later
Tim Lossen
Embracing Failure
Embracing Failure
Tim Lossen
Embracing Failure
Embracing Failure
Tim Lossen
Enemy of the State?
Enemy of the State?
Tim Lossen
Beyond Devops
Beyond Devops
Tim Lossen
All Your Core Are Belong To Us
All Your Core Are Belong To Us
Tim Lossen
Podularity FTW!
Podularity FTW!
Tim Lossen
Cubic Foot Gardening
Cubic Foot Gardening
Tim Lossen
Dashboard Mania
Dashboard Mania
Tim Lossen
Event-Stream Processing with Kafka
Event-Stream Processing with Kafka
Tim Lossen
Más contenido relacionado
La actualidad más candente
MongoDB at GUL
MongoDB at GUL
Israel Gutiérrez
Building Apps with MongoDB
Building Apps with MongoDB
Nate Abele
Building a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and Java
antoinegirbal
Pinterest的数据库分片架构
Pinterest的数据库分片架构
Tommy Chiu
Operational Intelligence with MongoDB Webinar
Operational Intelligence with MongoDB Webinar
MongoDB
MongoDB @ Frankfurt NoSql User Group
MongoDB @ Frankfurt NoSql User Group
Chris Harris
Become a Java GC Hero - All Day Devops
Become a Java GC Hero - All Day Devops
Tier1app
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
MongoDB
Nested and Parent/Child Docs in ElasticSearch
Nested and Parent/Child Docs in ElasticSearch
BeyondTrees
Introduction to Scala for Java Programmers
Introduction to Scala for Java Programmers
sbjug
Scala for the doubters
Scala for the doubters
Max Klyga
Introduction to MongoDB
Introduction to MongoDB
antoinegirbal
La actualidad más candente
(12)
MongoDB at GUL
MongoDB at GUL
Building Apps with MongoDB
Building Apps with MongoDB
Building a Scalable Inbox System with MongoDB and Java
Building a Scalable Inbox System with MongoDB and Java
Pinterest的数据库分片架构
Pinterest的数据库分片架构
Operational Intelligence with MongoDB Webinar
Operational Intelligence with MongoDB Webinar
MongoDB @ Frankfurt NoSql User Group
MongoDB @ Frankfurt NoSql User Group
Become a Java GC Hero - All Day Devops
Become a Java GC Hero - All Day Devops
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
MongoDB San Francisco 2013: Hash-based Sharding in MongoDB 2.4 presented by B...
Nested and Parent/Child Docs in ElasticSearch
Nested and Parent/Child Docs in ElasticSearch
Introduction to Scala for Java Programmers
Introduction to Scala for Java Programmers
Scala for the doubters
Scala for the doubters
Introduction to MongoDB
Introduction to MongoDB
Más de Tim Lossen
Apocalypse Later
Apocalypse Later
Tim Lossen
Embracing Failure
Embracing Failure
Tim Lossen
Embracing Failure
Embracing Failure
Tim Lossen
Enemy of the State?
Enemy of the State?
Tim Lossen
Beyond Devops
Beyond Devops
Tim Lossen
All Your Core Are Belong To Us
All Your Core Are Belong To Us
Tim Lossen
Podularity FTW!
Podularity FTW!
Tim Lossen
Cubic Foot Gardening
Cubic Foot Gardening
Tim Lossen
Dashboard Mania
Dashboard Mania
Tim Lossen
Event-Stream Processing with Kafka
Event-Stream Processing with Kafka
Tim Lossen
Into the Void
Into the Void
Tim Lossen
Treasure Island -- Concurrency in JRuby
Treasure Island -- Concurrency in JRuby
Tim Lossen
Dashboard Mania
Dashboard Mania
Tim Lossen
JRuby vs. Rubinius
JRuby vs. Rubinius
Tim Lossen
The Smallest Cluster in the World
The Smallest Cluster in the World
Tim Lossen
Announcing Euruko 2011
Announcing Euruko 2011
Tim Lossen
Memory: The New Disk
Memory: The New Disk
Tim Lossen
Key-Value-Stores -- The Key to Scaling?
Key-Value-Stores -- The Key to Scaling?
Tim Lossen
Cassandra vs. Redis
Cassandra vs. Redis
Tim Lossen
An Introduction to Membase
An Introduction to Membase
Tim Lossen
Más de Tim Lossen
(20)
Apocalypse Later
Apocalypse Later
Embracing Failure
Embracing Failure
Embracing Failure
Embracing Failure
Enemy of the State?
Enemy of the State?
Beyond Devops
Beyond Devops
All Your Core Are Belong To Us
All Your Core Are Belong To Us
Podularity FTW!
Podularity FTW!
Cubic Foot Gardening
Cubic Foot Gardening
Dashboard Mania
Dashboard Mania
Event-Stream Processing with Kafka
Event-Stream Processing with Kafka
Into the Void
Into the Void
Treasure Island -- Concurrency in JRuby
Treasure Island -- Concurrency in JRuby
Dashboard Mania
Dashboard Mania
JRuby vs. Rubinius
JRuby vs. Rubinius
The Smallest Cluster in the World
The Smallest Cluster in the World
Announcing Euruko 2011
Announcing Euruko 2011
Memory: The New Disk
Memory: The New Disk
Key-Value-Stores -- The Key to Scaling?
Key-Value-Stores -- The Key to Scaling?
Cassandra vs. Redis
Cassandra vs. Redis
An Introduction to Membase
An Introduction to Membase
Último
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
mohitsingh558521
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
Sergiu Bodiu
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
LoriGlavin3
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
Commit University
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
Fwdays
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
Florian Wilhelm
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
Lorenzo Miniero
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
Slibray Presentation
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
DianaGray10
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Precisely
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
Addepto
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
BookNet Canada
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
LoriGlavin3
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
BookNet Canada
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
LoriGlavin3
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
Pixlogix Infotech
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
2toLead Limited
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
Mattias Andersson
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
Alfredo García Lavilla
Último
(20)
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
Redis to the Rescue?
1.
Redis to the
Rescue? O’Reilly MySQL Conference 2011-04-13
2.
Who? • Tim Lossen
/ @tlossen • Berlin, Germany • backend developer at wooga
3.
4.
Redis Intro Case 1:
Monster World Case 2: Happy Hospital Discussion
5.
Redis Intro Case 1:
Monster World Case 2: Happy Hospital Discussion
6.
What? • key-value-store • in-memory
database • “data structure server”
7.
8.
Data Types • strings
(integers)
9.
Data Types • strings
(integers) • lists • hashes
10.
Data Types • strings
(integers) • lists • hashes • sets • sorted sets
11.
flickr.com/photos/atzu/2645776918
12.
Performance • same for
reads / writes
13.
Performance • same for
reads / writes • 50 K ops/second - regular notebook, EC2 instance
14.
Performance • same for
reads / writes • 50 K ops/second - regular notebook, EC2 instance • 200 K ops/second - intel core i7 X980 (3.33 GHz)
15.
Durability • snapshots • append-only
log
16.
Other Features • master-slave
replication • virtual memory • ...
17.
Redis Intro Case 1:
Monster World Case 2: Happy Hospital Discussion
18.
19.
Daily Active Users April
May June July Aug Sept Oct 2010
20.
Daily Active Users April
May June July Aug Sept Oct 2010
21.
Challenge • traffic growing
rapidly
22.
Challenge • traffic growing
rapidly • bottleneck: write throughput - EBS volumes pretty slow
23.
Challenge • traffic growing
rapidly • bottleneck: write throughput - EBS volumes pretty slow • MySQL already sharded - 4 x 2 = 8 shards
24.
Idea • move write-itensive
data to Redis
25.
Idea • move write-itensive
data to Redis • first candidate: inventory - integer fields - frequently changing
26.
27.
Solution • inventory =
Redis hash - atomic increment / decrement !
28.
Solution • inventory =
Redis hash - atomic increment / decrement ! • on-demand migration of users - with batch roll-up
29.
Results • quick win
- implemented in 2 weeks - 10% less load on MySQL servers
30.
Results • quick win
- implemented in 2 weeks - 10% less load on MySQL servers • decision: move over more data
31.
But ... • “honeymoon
soon over”
32.
But ... • “honeymoon
soon over” • growing memory usage (fragmentation) - servers need periodic “refresh” - replication dance
33.
Current Status • hybrid
setup - 4 MySQL master-slave pairs - 4 Redis master-slave pairs
34.
Current Status • hybrid
setup - 4 MySQL master-slave pairs - 4 Redis master-slave pairs • evaluating other alternatives - Riak, Membase
35.
Redis Intro Case 1:
Monster World Case 2: Happy Hospital Discussion
36.
37.
Challenge • expected peak
load: - 16000 concurrent users - 4000 requests/second - mostly writes
38.
“Memory is the
new Disk, Disk is the new Tape.” ⎯ Jim Gray
39.
Idea • use Redis
as main database - excellent (write) performance - virtual memory for capacity
40.
Idea • use Redis
as main database - excellent (write) performance - virtual memory for capacity • no sharding = simple operations
41.
Data Model • user
= single Redis hash - each entity stored in hash field (serialized to JSON)
42.
Data Model • user
= single Redis hash - each entity stored in hash field (serialized to JSON) • custom Ruby mapping layer (“Remodel”)
43.
44.
{“level”: 4, 1220032045
u1 “xp”: 241} u1_pets [“p7”, “p8”] {“pet_type”: p7 “Cat”} {“pet_type”: p8 “Dog”} {“level”: 1, 1234599660 u1 “xp”: 22} u1_pets [“p3”] ... ...
45.
{“level”: 4, 1220032045
u1 “xp”: 241} u1_pets [“p7”, “p8”] {“pet_type”: p7 “Cat”} {“pet_type”: p8 “Dog”} {“level”: 1, 1234599660 u1 “xp”: 22} u1_pets [“p3”] ... ...
46.
{“level”: 4, 1220032045
u1 “xp”: 241} u1_pets [“p7”, “p8”] {“pet_type”: p7 “Cat”} {“pet_type”: p8 “Dog”} {“level”: 1, 1234599660 u1 “xp”: 22} u1_pets [“p3”] ... ...
47.
{“level”: 4, 1220032045
u1 “xp”: 241} u1_pets [“p7”, “p8”] {“pet_type”: p7 “Cat”} {“pet_type”: p8 “Dog”} {“level”: 1, 1234599660 u1 “xp”: 22} u1_pets [“p3”] ... ...
48.
{“level”: 4, 1220032045
u1 “xp”: 241} u1_pets [“p7”, “p8”] {“pet_type”: p7 “Cat”} {“pet_type”: p8 “Dog”} {“level”: 1, 1234599660 u1 “xp”: 22} u1_pets [“p3”] ... ...
49.
{“level”: 4, 1220032045
u1 “xp”: 241} u1_pets [“p7”, “p8”] {“pet_type”: p7 “Cat”} {“pet_type”: p8 “Dog”} {“level”: 1, 1234599660 u1 “xp”: 22} u1_pets [“p3”] ... ...
50.
Virtual Memory • server:
24 GB RAM, 500 GB disk - can only keep “hot data” in RAM
51.
Virtual Memory • server:
24 GB RAM, 500 GB disk - can only keep “hot data” in RAM • 380 GB swap file - 50 mio. pages, 8 KB each
52.
Dec 2010: Crisis •
memory usage growing fast
53.
Dec 2010: Crisis •
memory usage growing fast • cannot take snapshots any more - cannot start new slaves
54.
Dec 2010: Crisis •
memory usage growing fast • cannot take snapshots any more - cannot start new slaves • random crashes
55.
Analysis • Redis virtual
memory not compatible with: - persistence - replication
56.
Analysis • Redis virtual
memory not compatible with: - persistence - replication • need to implement our own!
57.
Workaround • “dumper” process
- tracks active users - every 10 minutes, writes them into YAML file
58.
ruby
redis disk
59.
ruby
redis disk
60.
ruby
redis disk
61.
ruby
redis disk
62.
ruby
redis disk
63.
Workaround • in case
of Redis crash - start with empty database - restore users on demand from YAML files
64.
Real Solution • Redis
“diskstore” - keeps all data on disk - swaps data into memory as needed
65.
Real Solution • Redis
“diskstore” - keeps all data on disk - swaps data into memory as needed • under development (expected Q2)
66.
67.
Results • average response
time: 10 ms
68.
Results • average response
time: 10 ms • peak traffic: - 1500 requests/second - 15000 Redis ops/second
69.
Current Status • very
happy with setup - simple, robust, fast - easy to operate • still lots of spare capacity
70.
Redis Intro Case 1:
Monster World Case 2: Happy Hospital Discussion
71.
Advantages • order-of-magnitude performance
improvement - removes main bottleneck - enables simple architecture
72.
Disadvantages • main challenge:
durability - diskstore very promising
73.
Disadvantages • main challenge:
durability - diskstore very promising • no ad-hoc queries - think hard about data model - hybrid approach?
74.
Conclusion • Ruby +
Redis = killer combo
75.
Q&A
76.
redis.io github.com/tlossen/remodel wooga.com/jobs
Descargar ahora