flurrydb: a dynamically scalable relational database with virtual machine cloning

22
FlurryDB A Dynamically Scalable Relational Database with Virtual Machine Cloning Michael Mior and Eyal de Lara University of Toronto

Upload: michael-mior

Post on 24-Jun-2015

429 views

Category:

Technology


0 download

DESCRIPTION

Presentation for SYSTOR 2011 at IBM Haifa

TRANSCRIPT

Page 1: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

FlurryDB A Dynamically Scalable Relational Database with Virtual Machine Cloning

Michael Mior and Eyal de Lara

University of Toronto

Page 2: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Cluster Databases

• We use read-one write all (ROWA) replication

• Send reads to any server instance

• Send writes to all server instances

• Two-phase commit is required for writes

Load balancer

VM

DBMS

VM

DBMS

Page 3: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Problem

• Loads may fluctuate drastically over time

• Pay-as-you-go IaaS clouds should be ideal

However

We want to adapt the size of the cluster to match the load

Page 4: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Problem

• Databases have large state and are hard to scale

• A complete copy may be required for new instances

• Copying large databases may take hours

Queries

Replication copy data

boot replica

catch up

add replica

• Overprovisioning is necessary to maintain service

Page 5: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Solution – Virtual Machine Fork

• Analogous to fork() for OS processes • Clones start immediately • State fetched on-demand • Page faults fetch the memory or disk page

This can reduce instantiation time from minutes or hours to seconds

Page 6: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Master VM Master Clone VM

VM Fork

Page 7: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

FlurryDB

• Use VM fork to provision new instances and add elasticity to unmodified MySQL

• Making distributed commit cloning-aware to handle in-flight transactions

Queries

Replication clone add

replica

Page 8: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

FlurryDB Challenges

1. Incorporate new worker into cluster

2. Preserve application semantics

Page 9: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Incorporate new worker

• Clone must connect to the load balancer

• Load balancer must begin sending transactions to the clone

Page 10: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Preserve application semantics

• Transactions may be in-progress at the time of cloning

• Clone gets new IP address

• Doing nothing drops connections and transaction status is unknown

Clone VM

DBMS T’

New IP Address

Master VM

DBMS T ?

Page 11: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Solutions to consistency 1. Employ a write barrier

Master VM

DBMS

T’

2. Roll back all transactions in progress

3. Allow all transactions to complete

Clone VM

DBMS

Master VM

DBMS

Clone VM

DBMS

Master VM

DBMS

Clone VM

DBMS T T’

Page 12: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

FlurryDB: Consistency beyond VM fork

Solution

Use a proxy which is aware of VM fork inside the virtual machine to maintain the database connection

Page 13: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Two-phase commit during cloning

Master VM

Proxy

Database

T

T

Client

Load Balancer T

Clone VM

Proxy

Database

T’

T’

T’

fork

T

Page 14: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Replica addition delay

• Update 10,000 rows concurrently

• Clone and measure replica addition delay in two cases

• Write barrier - wait for outstanding writes to complete before cloning

• FlurryDB - use double-proxying to allow completion on the clone

Page 15: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Replica addition delay

Page 16: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Proxy overhead

•Measurement of large SELECT transfer times shows ~5% drop in bandwidth

•Reconnection to new servers ~10x faster with no authentication

Page 17: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

RUBBoS

• Simulates a news website such as Slashdot

• Users read, post, and comment on stories

• We run server at full capacity (25 clients)

• After 5 minutes, we clone to two servers and double the number of clients

• Throughput in queries per second is measured at the load balancer

Page 18: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

RUBBOS Results cloning at 300s

Page 19: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Summary

• FlurryDB adds elasticity to unmodified MySQL by interposing a cloning-aware proxy

• VM fork handles most of the issues with replica addition

• A proxy handles in-flight requests

• New replicas can be made available in seconds while maintaining consistency

Page 20: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Future Work

• Experiment with varying consistency protocols (e.g. master-slave, eventual consistency)

• Test scalability with larger numbers of clones

• Optimize virtual disk performance

• Provide support for transactional workloads

Page 21: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Questions?

Page 22: FlurryDB: A Dynamically Scalable Relational Database with Virtual Machine Cloning

Related Work

• “NoSQL” (perhaps more accurately, NoACID) systems using eventual consistency or key-value data models such as Cassandra or Dynamo

• Relational Cloud uses dynamic partitioning across a cluster of MySQL/PostgreS instances

• Urgaonkar et al. use rapid changes in resource allocate to provision a multi-tier Internet application

• Soundararajan et al. present dynamic replication policies for scaling database servers

• HyPer uses process fork and memory snapshots to enable a hybrid OLAP/OLTP workload