Dynamic Resource Allocation for Database Servers Running on Virtual - - PowerPoint PPT Presentation

dynamic resource allocation for database servers running
SMART_READER_LITE
LIVE PREVIEW

Dynamic Resource Allocation for Database Servers Running on Virtual - - PowerPoint PPT Presentation

Dynamic Resource Allocation for Database Servers Running on Virtual Storage Gokul Soundararajan, Daniel Lupei, Saeed Ghanbari, Adrian Daniel Popescu, Jin Chen, Cristiana Amza University of Toronto 1 Multi-tier Resource Allocation


slide-1
SLIDE 1

Dynamic Resource Allocation for Database Servers Running on Virtual Storage

Gokul Soundararajan, Daniel Lupei, Saeed Ghanbari, Adrian Daniel Popescu, Jin Chen, Cristiana Amza University of Toronto

1

slide-2
SLIDE 2

Multi-tier Resource Allocation

Consolidated Environment

Web Server Application Server Database Server

2

Composed of several tiers Application-B Application-A Share resources in each tier Can lead to interference

slide-3
SLIDE 3

Storage Database

Our Focus: Storage Hierarchy

Application-A Application-B

3

Buffer Pool Storage Cache Disk Bandwidth Want to use all resources efficiently Disk is a bottleneck for Database Apps

Network

slide-4
SLIDE 4

State of the Art

  • Previous work studied resources in isolation
  • Memory Partitioning: MRC [ASPLOS’04]
  • Disk Bandwidth: Facade [FAST’03], Argon [FAST’07], etc.
  • ... and many more
  • Want to use the storage hierarchy efficiently
  • However, performance depends on all layers
  • Interdependency between resources
  • E.g., Increasing buffer pool reduces number of storage accesses

4

slide-5
SLIDE 5

Motivating Scenario

Small Large

5

Buffer Pool Storage Cache Disk Bandwidth Cache Friendly 1 Outstanding I/O Cache Un-Friendly 10 Outstanding I/O Using Oracle ORION I/O tool

slide-6
SLIDE 6

Motivating Scenario

2.5 5.0 7.5 Shared Cache Disk Cache & Disk Small Large

6

Normalized Latency

Benefits cache- friendly workload Avoids disk interference Has best performance

slide-7
SLIDE 7

Contributions

  • Build performance models dynamically
  • Account for interdependencies between resources
  • Lightweight but still accurate
  • Multi-level Resource Allocator
  • Uses performance models to guide resource allocation
  • Corrects model errors through runtime sampling
  • Uses global utility (SLOs) to partition resources
  • Minimize sum of application latencies

7

slide-8
SLIDE 8

Approach

8

  • Build performance models
  • One per application
  • Derive function to predict application latency given configuration
  • Find resource partitioning setting
  • Minimize sum of application latencies
  • Find best setting using hill climbing

Lavg = f(ρc, ρs, ρd)

slide-9
SLIDE 9

Outline

  • Online Performance Models
  • What are they?
  • Why are they hard to build?
  • Multi-level Resource Allocator
  • Prototype Implementation
  • Experimental Results
  • Conclusions

9

slide-10
SLIDE 10

One-Level Cache Model

10

Rd(A) Cache size

  • Avg. Latency

Allocate in 32MB chunks

32 64 512

m=CacheSize/ChunkSize =1GB/32MB=32 choices

1G 32 choices Choose 512MB ... ...

slide-11
SLIDE 11

MRC Cache Model

11

Rd(A) Cache size Miss-Ratio

32 64 512 1G ... ...

Computes miss-ratio given an I/O trace Multiply by I/O latency gets

  • Avg. Latency
slide-12
SLIDE 12

Two-Level Cache Model

  • Performance affected by
  • DB Buffer Pool Size (m choices)
  • Storage Cache (n choices)
  • Performance model
  • Needs to consider all parameters (m*n choices)
  • 1GB caches allocated in 32MB chunks
  • m = 1GB/32MB = 32 settings
  • m*n = 1024 distinct settings

12

Changes the I/O trace at storage

slide-13
SLIDE 13

Two-Level Cache Model

13

256 512 768 256 512 768 1024 Buffer Pool Size (MB) Storage Cache Size (MB)

2 caches create a 3D surface

Buffer Pool Size Storage Cache Size Avg. Latency

32x32=1024 data points! 32 data points

High Latency Low Latency

slide-14
SLIDE 14

Overall Performance Model

14

Application

ρc ρs ρd

Buffer Pool Storage Cache Disk Bandwidth Needs 32x32x10=10240 samples 15 mins/sample takes 3 months!

slide-15
SLIDE 15

Outline

  • Online Performance Models
  • Multi-level Resource Allocator
  • Building performance models
  • Allocating resources using models
  • Prototype Implementation
  • Experimental Results
  • Conclusions

15

slide-16
SLIDE 16

Key Observations

  • Known cache replacement policies
  • Most cache replacement algorithms are LRU
  • Only as effective as the largest cache (cache inclusiveness)
  • Disk is a closed loop system
  • Rate of responses is same as rate of requests
  • Performance proportional to the disk bandwidth fraction

16

slide-17
SLIDE 17

Cache Inclusiveness

17

LRU LRU

8 8 1 6 8 4 5 6 3 4 8 8

I/Os: 0 I/Os: 1

8

slide-18
SLIDE 18

Cache Inclusiveness

18

LRU LRU

8 8 1 6 8 4 5 6 3 4 8 8 1 6

I/Os: 6

8 4 5 6 3 4 3 4 3 4 5 6 8

Storage cache includes data in the buffer pool

slide-19
SLIDE 19

Cache Inclusiveness

19

LRU LRU

8 8 1 6 8 4 5 6 3 4 8 8 1 6

I/Os: 6

8 4 5 6 3 4 3 5 3 4 5 6 8

Buffer pool includes data in the storage cache

slide-20
SLIDE 20

Approximate Single Cache Model (LRU)

20

8 8 1 6 8 4 5 6 3 4 8 8 1 6 8 4 5 6 3 4

I/Os: 6

Same Number of I/Os

LRU LRU

3 4 3 4 5 6 8

Mc(max[ρc, ρs])

3 4 5 6 8

LRU

slide-21
SLIDE 21

Cache Model (DEMOTE)

21

  • Maintain cache exclusiveness
  • E.g., using DEMOTEs [USENIX’02]
  • Every block brought into buffer pool is not cached below
  • Only evictions from buffer pool cached in storage cache
  • Approximate performance using single cache
  • Mc(ρc + ρs)
slide-22
SLIDE 22

Find Best Partitioning Setting

22

Find Best Resource Allocation Setting

Buffer Pool Size

Storage Cache Size

Latency

App-1 App-2

Buffer Pool Size

Storage Cache Size

Latency

Minimize sum of application latencies

slide-23
SLIDE 23
  • Observation: Closed loop system
  • Rate of responses same as rate of requests
  • Use interactive response time law
  • Performance proportional to disk bandwidth fraction
  • Measure base disk latency:
  • Predict latency for smaller bandwidth fractions

Disk Model

23

Ld(ρd) = Ld(1) ρd Ld(1)

slide-24
SLIDE 24

Putting it All Together

24

Application

Mc(ρc)Ms(ρc, ρs)N

Storage Cache Buffer Pool

Approximate Single-Level Cache

Can now be solved using MRC

= Mc(max[ρc, ρs])N

slide-25
SLIDE 25

Putting it all Together

Application

Hc(ρc)Lc Mc(ρc)Hs(ρc, ρs)Lnet Mc(ρc)Ms(ρc, ρs)Ld(ρd)

25

slide-26
SLIDE 26

Inaccuracies in the Model

  • Cache Model
  • Approximations to LRU, i.e., CLOCK
  • Large fraction of writes in the workload
  • Disk Model
  • Using Quanta-based scheduler [Wachs et. al, FAST’07]
  • Interference due to disk seeks at small quanta
  • Inaccuracies localized in known regions
  • E.g., Small disk quanta

26

slide-27
SLIDE 27

Iterative Refinement

  • Build model
  • Use trace collected at the database buffer pool
  • Refine the model
  • Use cross-validation to measure quality
  • Selectively sample where error is high
  • Interpolate computed and measured samples
  • Using regression (SVM)

27

slide-28
SLIDE 28

Virtual Storage Prototype

28

Storage MySQL Linux

NBD

CLIENT

Block Layer SCSI Buffer Pool Disk

SERVER

NBD

Linux

Block Layer SCSI Disk Network Disk Disk Cache Quanta

slide-29
SLIDE 29

Experimental Setup

  • Benchmarks
  • UNIFORM (microbenchmark), TPC-W and TPC-C
  • LAMP Architecture
  • Linux, Apache 1.3, MySQL/InnoDB 5.0, and PHP 5.0
  • Cache Configuration
  • MySQL buffer pool = 1GB
  • Storage cache = 1GB
  • Using InnoDB cache replacement in MySQL, CLOCK in storage

cache

29

slide-30
SLIDE 30

Our Algorithms

30

  • GLOBAL
  • Gather trace at the buffer pool
  • Measure base disk latency
  • Compute performance using performance model
  • GLOBAL+
  • Run GLOBAL
  • Evaluate model accuracy
  • Refine model using runtime samples
slide-31
SLIDE 31

Algorithms for Comparison

31

  • MRC
  • Partition cache (independently) using miss-ratio curves
  • DISK
  • Partition caches equally, determine best disk quanta
  • MRC+DISK
  • Run MRC then DISK
  • IDEAL*
  • Build model with SVM using 16*16*5=1280 sampled configurations
slide-32
SLIDE 32

Roadmap of Results

32

  • Multi-level cache allocator
  • Using LRU and DEMOTE cache replacement policies
  • Multi-level cache and disk
  • Accuracy of computed models
slide-33
SLIDE 33

Miss-Ratio Curves

33

25 50 75 100 128 256 384 512 640 768 896 1024 Miss Ratio (%) Buffer Pool Size (MB) TPC-W TPC-C UNIFORM

slide-34
SLIDE 34

Multi-Level Caching (LRU)

34

Optimal HeatMap Lighter: Better Darker: Worse Optimal

Storage Cache Size (A) Buffer Pool Size (A) 1G 1G

2 TPC-W Instances

slide-35
SLIDE 35

Multi-Level Caching (DEMOTE)

35

Optimal

Storage Cache Size (A) Buffer Pool Size (A) 1G 1G

2 TPC-W Instances

slide-36
SLIDE 36

Roadmap of Results

36

  • Multi-level cache allocator
  • Multi-level cache and disk
  • Using two identical applications
  • Using different applications
  • Accuracy of computed models
slide-37
SLIDE 37

UNIFORM/UNIFORM

1.682 3.364 5.046 6.728 8.410

GLOBAL GLOBAL+ MRC DISK MRC+DISK IDEAL*

UNIFORM UNIFORM

37

Average Latency (ms)

Allocate caches to 50/50 Matches GLOBAL

slide-38
SLIDE 38

TPC-W/UNIFORM

1.5 3.0 4.5 6.0 7.5

GLOBAL GLOBAL+ MRC DISK MRC+DISK IDEAL*

TPC-W UNIFORM

38

Average Latency (ms)

Allocate caches to 50/50 Not enough buffer pool to UNIFORM Compensate for MRC settings

slide-39
SLIDE 39

TPC-W/TPC-C

0.16 0.32 0.48 0.64 0.80

GLOBAL GLOBAL+ MRC DISK MRC+DISK IDEAL*

TPC-W TPC-C

39

Average Latency (ms)

Corrects model at runtime Corrects imbalance in MRC TPC-C allocated more in both

slide-40
SLIDE 40

Roadmap of Results

40

  • Multi-level cache allocator
  • Multi-level cache and disk
  • Accuracy of computed models
  • Cache model
  • Disk model
slide-41
SLIDE 41

Cache Model Accuracy (TPC-W)

41

128 256 384 512 640 768 896 1024 0 128 256 384 512 640 768 896 1024 Storage Cache Size (MB) Buffer Pool Size (MB) 10 20 30 40 50 Error (%)

Localized in the middle

slide-42
SLIDE 42

Disk Model Accuracy (TPC-W)

42

10 20 30 40 50 0.2 0.4 0.6 0.8 1 Latency (ms) Disk Quota Measured Computed

slide-43
SLIDE 43

Conclusions

  • Problem
  • Need to consider resources on multiple tiers
  • Independent cache/disk allocators are not sufficient
  • Dynamic allocation of cache hierarchy and disk
  • Build performance models dynamically
  • Iteratively refine (if necessary)
  • Use models for global resource partitioning
  • Performance up to 2.9 better than single resource allocators

43

slide-44
SLIDE 44

Thank you.

44