Energy-aware Memory Management
through Database Buffer Control
Chang S. Bae
,
Tayeb Jamel
Northwestern Univ. Intel Corporation
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
Better performance
More energy consumption
More memory
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
Outline
Introduction
Background and metrics
Application driven approach
Memory usage in database engine Metrics
Database buffer pool control
Evaluation
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
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
Shared buffer Shared buffer
Page (Disk) cache Page (Disk) cache
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
Shared buffer Shared buffer
Page (Disk) cache Page (Disk) cache
Database manager uses memory
as buffer pool
DB manager backend DB manager backend Shared buffer Shared buffer Disk blocks Disk blocks Page (Disk) cache Page (Disk) cacheMemory access
Disk access
Application layer OS layer
Page (Disk) cache Page (Disk) cache
Managing Buffer pool
with page caching disabled
Memory access Disk access Application layer OS layer
In memory
Disk blocks Disk blocks DB manager backend DB manager backend Shared buffer Shared bufferMonitoring buffer pool stats
Buffer hit rate (Bhit)
When to expand buffer pool
Buffer utilization (Butil)
Recently used buffer size
Scenario for workloads
Online transactional processing (OLTP)
Amount of loaded database varies
Different number of warehouse in 3-phases Preserve TPC-C compliancy
Amount of loaded data
Time
Buffer pool setup for database load
>
Buffer Buffer Buffer Buffer>
>
Lightweight Buffer Buffer Limited buffer pool (powerdown) Sufficient buffer pool (default) HeavyweightBhit: possible to infer
when to expand buffer pool
85 90 95 100 1 6 11 16 21 26 31 36 41 46 51 56 Bh it(% ) Minutes
Limited buffer pool (powerdown) Amount of
loaded data
Buffer pool size of powerdown
Bhit: hard to infer
when to shrink buffer pool
85 90 95 100 Bh it(% )
Sufficient buffer pool (default) Buffer pool size
of default
Time Amount of
0 2500 5000 7500 10000 1 6 11 16 21 26 31 36 41 46 51 56 Butil Sufficient buffer pool (default)
Limited buffer pool (powerdown)
Butil: possible to infer
when to shrink buffer pool
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
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
Shrink: waiting for stabilized
Transit to Stable, if warmed up against cold misses
Stable
∆Bhit < 0.1%
Shrink: check if expansion needed
Monitor Bhit and compare Threshold
Bhit
Monitor Butil to keep maximum as Threshold
ButilUnstable Stable
ThresholdButil = max(Butil)
Expanding buffer pool if compromised performance
Fixed ThresholdBhit to 99% for the best performance
Unstable
Stable Expand Expand Unstable
Bhit < 99%
Expansion: waiting for being
stabilized
Transit to Stable if warmed up against cold misses
Unstable
Stable Expand Expand Unstable
Stable
∆Bhit < 0.1%
Move to Pre-Shrink when buffer pool looks sufficient
Pre-Shrink: monitor Butil and compare Threshold
ButilUnstable
Stable Expand Expand Unstable
Stable
Expansion: check if shrink needed
Pre-Shrink
Shrink buffer pool if Butil is below Threshold
ButilUnstable
Stable Expand Expand Unstable
Bhit < 99%
Stable
ThresholdButil = max(Butil)
Buffer pool shrink
Pre-Shrink
Shrink Shrink
Outline
Introduction
Background and metrics
Database buffer pool control
Evaluation
Software and hardware setup Experimental results
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
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) A Socket Nehalem EX Platformdefault configuration
No memory power control
One memory board
Socket 0 1 2 3
default configuration
No memory power control
taken by DB manager
taken by other processes free Expanded buffer pool Dummy OS OLTP workload Active
powerdown
configuration
Power-down secondary memory boards
Power-down (or Inactive) Active Shrunken buffer pool Socket 0 1 2 3 taken by DB manager
taken by other processes free
adaptive
configuration
Socket 3 Expand Expand Shrink Shrink Socket 0 1 2 3 Socket 0 1 2 3Opportunity of energy savings
3.7E+05 4.0E+05 4.3E+05 4.6E+05 Joul e Energy consumption Default Powerdown Adaptive -4% over Default -8% over DefaultAdaptively retained performance
0 20 40 60 mill ise cond sAverage 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
Questions?
Questions and Answers
Author contact information
[email protected], http://www.changbae.org [email protected]
Project website
Intel Energy Checker SDK
http://software.intel.com/en-us/whatif