Energy-aware Memory Management through Database Buffer Control

streambabySoftware and s/w Development

Dec 14, 2013 (3 years and 7 months ago)

78 views

Energy
-
aware Memory Management
through Database Buffer Control

Chang S.
Bae
,

Tayeb

Jamel


Northwestern Univ.

Intel Corporation


Presented by Chang S.
Bae

Goal and motivation


Energy
-
aware memory management in software


In idle time, unload memory to save energy


In peak time, load memory to get performance



2

Better performance

More energy consumption

Limited performance

Saving energy consumption

More memory

Less memory

Adaptive management

Contributions of this work


Energy
-
aware memory management in software


In idle time, unload memory to save energy


In peak time, load memory to get performance



Application
-
level approach


Dynamically adaptive buffer management
in data base engine


Real measurements


Design and implement in a system


3

Outline


Introduction


Background and metrics


Application driven approach


Memory usage in database engine


Metrics


Database buffer pool control


Evaluation


Conclusion

4

Application driven energy savings


Software over hardware


Hardware approach takes more delay to do
measurement and inference



Application
-
level over OS
-
level


Application itself directly and best knows its behavior

5

Applied to
database buffer pool management

6

Disk blocks

Disk blocks

Memory access

Disk access

If
shared
buffer

misses

Application layer

OS layer

DB manager

backend

DB manager

backend

Database manager uses memory
as buffer pool

S
hared buffer

S
hared buffer

Page (Disk) cache

Page (Disk) cache

7

Disk blocks

Disk blocks

Memory access

Disk access

If
OS

disk
buffer cache

misses

Application layer

OS layer

DB manager

backend

DB manager

backend

Database manager uses memory
as buffer pool

S
hared buffer

S
hared buffer

Page (Disk) cache

Page (Disk) cache

Database manager uses memory
as buffer pool

8

DB manager

backend

DB manager

backend

S
hared buffer

S
hared buffer

Disk blocks

Disk blocks

Page (Disk) cache

Page (Disk) cache

Memory access

Disk access

Application layer

OS layer

In memory

Page (Disk) cache

Page (Disk) cache

Managing Buffer pool

with page caching disabled

9

Memory access

Disk access

Application layer

OS layer

In memory

Disk blocks

Disk blocks

DB manager

backend

DB manager

backend

S
hared buffer

S
hared buffer

Monitoring buffer pool stats


Buffer hit rate (
Bhit
)


When to
expand

buffer pool



Buffer utilization (
Butil
)


Recently used buffer size


When to
shrink

buffer pool

10

Scenario for workloads


Online transactional processing (OLTP)


Amount of loaded database varies


Different number
of
warehouse in 3
-
phases


Preserve TPC
-
C compliancy

11

Amount of

loaded data

Time

Lightweight0

Heavyweight

Lightweight
1

Buffer pool setup for database load

12

>



Buffer

Buffer

Buffer

Buffer

>



>



Lightweight

Buffer

Buffer

Limited

b
uffer pool
(
powerdown
)

Sufficient
buffer pool
(
default
)

Heavyweight

Opportunity to save energy

Possible to degrade performance

Bhit
: possible to infer

when to expand
buffer pool

13

85
90
95
100
1
6
11
16
21
26
31
36
41
46
51
56
Bhit(%)

Minutes

Limited buffer pool (powerdown)
Amount of

loaded data

Buffer pool size

of
powerdown

Time

Bhit
: hard to infer

when to shrink
buffer pool

14

85
90
95
100
1
6
11
16
21
26
31
36
41
46
51
56
Bhit(%)

Minutes

Sufficient buffer pool (default)
Buffer pool size

of
default

Time

Amount of

loaded data

0
2500
5000
7500
10000
1
6
11
16
21
26
31
36
41
46
51
56
Butil

Minutes

Sufficient buffer
pool (default)
Limited buffer pool
(powerdown)
Butil
: possible to infer

when to shrink
buffer pool

15

Time

Buffer pool size

of
default

Buffer pool size

of
powerdown

Amount of

loaded data

Outline


Introduction


Background and metrics


Database buffer pool control


Threshold
-
based heuristics


State transitions


Evaluation


Conclusion

16

Threshold
-
based heuristics


High
-
level states


Expansion
: increased buffer pool size


Shrink
: reduced buffer pool
size


Assuming two distinct domains



Threshold value triggers state transition


Threshold for
Bhit

triggers expansion


Threshold for
Butil

triggers shrink




17

Shrink
: waiting for stabilized


Transit to
Stable
, if warmed up against cold misses


18


Stable


Bhit

< 0.1%

Unstable

Shrink

Expansion

Shrink
: check if expansion needed


Monitor
Bhit

and compare
Threshold
Bhit


Monitor
Butil

to keep maximum as
Threshold
Butil




19

Unstable


Stable

Threshold
Butil

=
max(
Butil
)

Shrink

Expansion


Expanding buffer pool if compromised performance


Fixed
Threshold
Bhit

to
99
% for the best performance



20

Unstable


Stable

Expand

Expand

Unstable

Bhit

< 99%

Buffer pool expansion

Shrink

Expansion

Expansion
: waiting for being
stabilized


Transit to
Stable

if warmed up against cold misses

21

Unstable


Stable

Expand

Expand

Unstable

Stable


Bhit

< 0.1%


Bhit

< 0.1%

Shrink

Expansion


Move to
Pre
-
Shrink

when buffer pool looks sufficient


Pre
-
Shrink
: monitor
Butil

and compare
Threshold
Butil


22

Unstable


Stable

Expand

Expand

Unstable

Stable

Expansion
: check if shrink needed

Pre
-
Shrink

Bhit

≥ 99%

Shrink

Expansion


Shrink buffer
pool if
Butil

is below
Threshold
Butil

23

Unstable


Stable

Expand

Expand

Unstable

Bhit

< 99%

Stable

Threshold
Butil

=
max(
Butil
)

Buffer pool shrink

Pre
-
Shrink

Shrink

Shrink

Butil

<
Threshold
Butil


Shrink

Expansion

Outline


Introduction


Background and metrics


Database buffer pool control


Evaluation


Software and hardware setup


Experimental results


Conclusion

24

Software setup


OLTP


TPCC
UVa

v
.1.2.3


Modified to load different size of data in 3
-
phases



DB manager


PostgreSQL

v.8.4.6


Resize buffer pool during a runtime



OS


RedHat

Enterprise Linux
v.5.5



Modified Kernel
v.2.6.28.8


Consecutive virtual address linear to physical address in
each socket



25

Hardware setup


CPU


Intel Xeon
x7560

2.26GHz


64 cores (
16 cores x 4 sockets
)


DRAM

DDR3
1066MHz


128 GB (
16GB x 2 memory
-



boards x 4 sockets
)


26

A memory board

A Socket

Nehalem EX
Platform

default

configuration


No memory power control

27

One
m
emory

b
oard

Socket 0 1 2 3

Active

default

configuration


No memory power control

28

taken by DB manager

taken by other processes

f
ree

Expanded

buffer pool

Dummy

OS

OLTP
workload

Active

Socket 0 1 2 3

powerdown

configuration


Power
-
down secondary memory boards

29

Power
-
down
(or Inactive
)

Active

Shrunken

buffer pool

Socket 0 1 2 3

taken by DB manager

taken by other processes

f
ree

adaptive

configuration

30

Socket 3

Expand

Expand

Shrink

Shrink

taken by DB manager

taken by other processes

f
ree

Socket 0 1 2 3

Socket 0 1 2 3

Power
-
down
(or Inactive)

Active

Opportunity of energy savings

31

3.7E+05
4.0E+05
4.3E+05
4.6E+05
Joule

Energy consumption

Default
Powerdown
Adaptive
-
4
% over
Default

-
8
% over
Default

Adaptively retained performance

32

0
20
40
60
milliseconds

Average response time

Default
Powerdown
Adaptive
Conclusion


Opportunity to save energy in DRAM


Increasing energy consumption in memory resource


Unused memory in idle time



Energy
-
aware database buffer pool management


Application driven approach


Threshold based heuristics


Energy saving without degraded performance


Extensible for wide applicability


33

Questions?


Questions and Answers



Author contact information


Chang.Bae@eecs.northwestern.edu,

http://www.changbae.org


J
amel.Tayeb@intel.com



Project website


Intel Energy Checker SDK


http://software.intel.com/en
-
us/whatif



34

EECS