Redis to the Rescue? O Reilly MySQL Conference

Similar documents
O Reilly RailsConf,

Jargons, Concepts, Scope and Systems. Key Value Stores, Document Stores, Extensible Record Stores. Overview of different scalable relational systems

ICALEPS 2013 Exploring No-SQL Alternatives for ALMA Monitoring System ADC

NoSQL Databases Analysis

Database Solution in Cloud Computing

Introduction to Database Services

GFS Overview. Design goals/priorities Design for big-data workloads Huge files, mostly appends, concurrency, huge bandwidth Design for failures

Introduction Storage Processing Monitoring Review. Scaling at Showyou. Operations. September 26, 2011

Topics. History. Architecture. MongoDB, Mongoose - RDBMS - SQL. - NoSQL

App Engine: Datastore Introduction

Cassandra, MongoDB, and HBase. Cassandra, MongoDB, and HBase. I have chosen these three due to their recent

ApsaraDB for Redis. Product Introduction

NoSQL Databases MongoDB vs Cassandra. Kenny Huynh, Andre Chik, Kevin Vu

Triple R Riak, Redis and RabbitMQ at XING

The Right Read Optimization is Actually Write Optimization. Leif Walsh

NoSQL systems. Lecture 21 (optional) Instructor: Sudeepa Roy. CompSci 516 Data Intensive Computing Systems

The Google File System

Name: Instructions. Problem 1 : Short answer. [48 points] CMU / Storage Systems 20 April 2011 Spring 2011 Exam 2

Scaling. Marty Weiner Grayskull, Eternia. Yashh Nelapati Gotham City

Amazon ElastiCache 8/1/17. Why Amazon ElastiCache is important? Introduction:

Introduction to K2View Fabric

Azure-persistence MARTIN MUDRA

The Google File System

Big Data Infrastructure CS 489/698 Big Data Infrastructure (Winter 2017)

CSE 124: Networked Services Fall 2009 Lecture-19

Introduction to Hadoop. Owen O Malley Yahoo!, Grid Team

Overview of Data Management

CIB Session 12th NoSQL Databases Structures

<Insert Picture Here> MySQL Web Reference Architectures Building Massively Scalable Web Infrastructure

Distributed Systems. Lec 10: Distributed File Systems GFS. Slide acks: Sanjay Ghemawat, Howard Gobioff, and Shun-Tak Leung

FAWN as a Service. 1 Introduction. Jintian Liang CS244B December 13, 2017

Physical Storage Media

Managing IoT and Time Series Data with Amazon ElastiCache for Redis

ASN Configuration Best Practices

CSE 124: Networked Services Lecture-16

Putting together the platform: Riak, Redis, Solr and Spark. Bryan Hunt

SQL, NoSQL, MongoDB. CSE-291 (Cloud Computing) Fall 2016 Gregory Kesden

NoVA MySQL October Meetup. Tim Callaghan VP/Engineering, Tokutek

MySQL in the Cloud Tricks and Tradeoffs

The Google File System

CISC 7610 Lecture 5 Distributed multimedia databases. Topics: Scaling up vs out Replication Partitioning CAP Theorem NoSQL NewSQL

CS 102. Big Data. Spring Big Data Platforms

Building High Performance Apps using NoSQL. Swami Sivasubramanian General Manager, AWS NoSQL

A Brief Introduction of TiDB. Dongxu (Edward) Huang CTO, PingCAP

Migrating and living on RDS/Aurora. life after Datacenters

Goal of the presentation is to give an introduction of NoSQL databases, why they are there.

Extreme Computing. NoSQL.

Introduction to NoSQL Databases

Manual Mysql Query Cache Hit Rate 0

The Google File System (GFS)

Quick Start Guide. Version R94. English

MSG: An Overview of a Messaging System for the Grid

Lecture 21: Logging Schemes /645 Database Systems (Fall 2017) Carnegie Mellon University Prof. Andy Pavlo

BBM371- Data Management. Lecture 1: Course policies, Introduction to DBMS

Principal Solutions Architect. Architecting in the Cloud

Pushing the Limits. ADSM Symposium Sheelagh Treweek September 1999 Oxford University Computing Services 1

Accelerating NoSQL. Running Voldemort on HailDB. Sunny Gleason March 11, 2011

Distributed File Systems II

Improving Perforce Performance At Research In Motion (RIM)

Scaling. Yashh Nelapati Gotham City. Marty Weiner Krypton. Friday, July 27, 12

Engineering Goals. Scalability Availability. Transactional behavior Security EAI... CS530 S05

Choosing Hardware and Operating Systems for MySQL. Apr 15, 2009 O'Reilly MySQL Conference and Expo Santa Clara,CA by Peter Zaitsev, Percona Inc

MySQL Performance Optimization and Troubleshooting with PMM. Peter Zaitsev, CEO, Percona

REO SERIES RA2000. Application Note for Creating a Disk-to-Disk (D2D) Backup Strategy Utilizing the RA2000 with VERITAS Backup Exec 8.

goals monitoring, fault tolerance, auto-recovery (thousands of low-cost machines) handle appends efficiently (no random writes & sequential reads)

h p://

LazyBase: Trading freshness and performance in a scalable database

Database Architectures

ECE 7650 Scalable and Secure Internet Services and Architecture ---- A Systems Perspective

The SHARED hosting plan is designed to meet the advanced hosting needs of businesses who are not yet ready to move on to a server solution.

In-Memory Data processing using Redis Database

Google File System. Sanjay Ghemawat, Howard Gobioff, and Shun-Tak Leung Google fall DIP Heerak lim, Donghun Koo

Fixing Twitter.... and Finding your own Fail Whale. John Adams Twitter Operations

Sage 300 ERP. Compatibility Guide Version Revised: Oct 1, Version 6.0 Compatibility Guide i

Deploying a Highly Available Distributed Caching Layer on Oracle Cloud Infrastructure using Memcached & Redis

elasticsearch The Road to a Distributed, (Near) Real Time, Search Engine Shay Banon

Voldemort. Smruti R. Sarangi. Department of Computer Science Indian Institute of Technology New Delhi, India. Overview Design Evaluation

GridGain and Apache Ignite In-Memory Performance with Durability of Disk

Advanced Databases Lecture 17- Distributed Databases (continued)

Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Last Class. Today s Class. Faloutsos/Pavlo CMU /615

Release Notes. NovaBACKUP Network Version July 2017

Manually Make Computer Faster For Gaming Windows 7 Ultimate

Introduction to Scientific Data Management

Introduction to Scientific Data Management

Dr. Chuck Cartledge. 3 Dec. 2015

A+ Suite Software Release Note Nov

To Shard or Not to Shard That is the question! Peter Zaitsev April 21, 2016

TS7700 Technical Update TS7720 Tape Attach Deep Dive

A+ Suite Software Release Note May

HyPer-sonic Combined Transaction AND Query Processing

Near Memory Key/Value Lookup Acceleration MemSys 2017

Sample Title. Magento 2 performance comparison in different environments. DevelopersParadise 2016 / Opatija / Croatia

File Systems. CS170 Fall 2018

HyPer-sonic Combined Transaction AND Query Processing

CompSci 516 Database Systems

THE FLEXIBLE DATA-STRUCTURE SERVER THAT COULD.

Running a transactional Database on top of RamCloud

Identifying and Eliminating Backup System Bottlenecks: Taking Your Existing Backup System to the Next Level

Using PostgreSQL in Tantan - From 0 to 350bn rows in 2 years

Google File System. Arun Sundaram Operating Systems

Transcription:

Redis to the Rescue? O Reilly MySQL Conference 2011-04-13

Who? Tim Lossen / @tlossen Berlin, Germany backend developer at wooga

Redis Intro Case 1: Monster World Case 2: Happy Hospital Discussion

Redis Intro Case 1: Monster World Case 2: Happy Hospital Discussion

What? key-value-store in-memory database data structure server

Data Types strings (integers)

Data Types strings (integers) lists hashes

Data Types strings (integers) lists hashes sets sorted sets

flickr.com/photos/atzu/2645776918

Performance same for reads / writes

Performance same for reads / writes 50 K ops/second - regular notebook, EC2 instance

Performance same for reads / writes 50 K ops/second - regular notebook, EC2 instance 200 K ops/second - intel core i7 X980 (3.33 GHz)

Durability snapshots append-only log

Other Features master-slave replication virtual memory...

Redis Intro Case 1: Monster World Case 2: Happy Hospital Discussion

Daily Active Users April May June July Aug Sept Oct 2010

Daily Active Users April May June July Aug Sept Oct 2010

Challenge traffic growing rapidly

Challenge traffic growing rapidly bottleneck: write throughput - EBS volumes pretty slow

Challenge traffic growing rapidly bottleneck: write throughput - EBS volumes pretty slow MySQL already sharded - 4 x 2 = 8 shards

Idea move write-itensive data to Redis

Idea move write-itensive data to Redis first candidate: inventory - integer fields - frequently changing

Solution inventory = Redis hash - atomic increment / decrement!

Solution inventory = Redis hash - atomic increment / decrement! on-demand migration of users - with batch roll-up

Results quick win - implemented in 2 weeks - 10% less load on MySQL servers

Results quick win - implemented in 2 weeks - 10% less load on MySQL servers decision: move over more data

But... honeymoon soon over

But... honeymoon soon over growing memory usage (fragmentation) - servers need periodic refresh - replication dance

Current Status hybrid setup - 4 MySQL master-slave pairs - 4 Redis master-slave pairs

Current Status hybrid setup - 4 MySQL master-slave pairs - 4 Redis master-slave pairs evaluating other alternatives - Riak, Membase

Redis Intro Case 1: Monster World Case 2: Happy Hospital Discussion

Challenge expected peak load: - 16000 concurrent users - 4000 requests/second - mostly writes

Memory is the new Disk, Disk is the new Tape. Jim Gray

Idea use Redis as main database - excellent (write) performance - virtual memory for capacity

Idea use Redis as main database - excellent (write) performance - virtual memory for capacity no sharding = simple operations

Data Model user = single Redis hash - each entity stored in hash field (serialized to JSON)

Data Model user = single Redis hash - each entity stored in hash field (serialized to JSON) custom Ruby mapping layer ( Remodel )

1220032045 u1 u1_pets p7 p8 1234599660 u1 u1_pets { level : 4, xp : 241} [ p7, p8 ] { pet_type : Cat } { pet_type : Dog } { level : 1, xp : 22} [ p3 ]......

1220032045 u1 u1_pets p7 p8 1234599660 u1 u1_pets { level : 4, xp : 241} [ p7, p8 ] { pet_type : Cat } { pet_type : Dog } { level : 1, xp : 22} [ p3 ]......

1220032045 u1 u1_pets p7 p8 1234599660 u1 u1_pets { level : 4, xp : 241} [ p7, p8 ] { pet_type : Cat } { pet_type : Dog } { level : 1, xp : 22} [ p3 ]......

1220032045 u1 u1_pets p7 p8 1234599660 u1 u1_pets { level : 4, xp : 241} [ p7, p8 ] { pet_type : Cat } { pet_type : Dog } { level : 1, xp : 22} [ p3 ]......

1220032045 u1 u1_pets p7 p8 1234599660 u1 u1_pets { level : 4, xp : 241} [ p7, p8 ] { pet_type : Cat } { pet_type : Dog } { level : 1, xp : 22} [ p3 ]......

1220032045 u1 u1_pets p7 p8 1234599660 u1 u1_pets { level : 4, xp : 241} [ p7, p8 ] { pet_type : Cat } { pet_type : Dog } { level : 1, xp : 22} [ p3 ]......

Virtual Memory server: 24 GB RAM, 500 GB disk - can only keep hot data in RAM

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

Dec 2010: Crisis memory usage growing fast

Dec 2010: Crisis memory usage growing fast cannot take snapshots any more - cannot start new slaves

Dec 2010: Crisis memory usage growing fast cannot take snapshots any more - cannot start new slaves random crashes

Analysis Redis virtual memory not compatible with: - persistence - replication

Analysis Redis virtual memory not compatible with: - persistence - replication need to implement our own!

Workaround dumper process - tracks active users - every 10 minutes, writes them into YAML file

ruby redis disk

ruby redis disk

ruby redis disk

ruby redis disk

ruby redis disk

Workaround in case of Redis crash - start with empty database - restore users on demand from YAML files

Real Solution Redis diskstore - keeps all data on disk - swaps data into memory as needed

Real Solution Redis diskstore - keeps all data on disk - swaps data into memory as needed under development (expected Q2)

Results average response time: 10 ms

Results average response time: 10 ms peak traffic: - 1500 requests/second - 15000 Redis ops/second

Current Status very happy with setup - simple, robust, fast - easy to operate still lots of spare capacity

Redis Intro Case 1: Monster World Case 2: Happy Hospital Discussion

Advantages order-of-magnitude performance improvement - removes main bottleneck - enables simple architecture

Disadvantages main challenge: durability - diskstore very promising

Disadvantages main challenge: durability - diskstore very promising no ad-hoc queries - think hard about data model - hybrid approach?

Conclusion Ruby + Redis = killer combo

Q & A

redis.io github.com/tlossen/remodel wooga.com/jobs