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 More memory Better performance More energy consumption Adaptive management Less memory Limited performance Saving energy consumption 2
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 Applied to database buffer pool management 5
Database manager uses memory as buffer pool If shared buffer misses DB manager backend Shared buffer Page (Disk) cache Memory access Disk access Application layer OS layer Disk blocks 6
Database manager uses memory as buffer pool DB manager backend Shared buffer Memory access Disk access Application layer If OS disk buffer cache misses Page (Disk) cache Disk blocks OS layer 7
Database manager uses memory as buffer pool In memory DB manager backend Shared buffer Memory access Disk access Application layer Page (Disk) cache OS layer Disk blocks 8
Managing Buffer pool with page caching disabled In memory DB manager backend Shared buffer Memory access Disk access Application layer Page (Disk) cache OS layer Disk blocks 9
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 Lightweight0 Heavyweight Lightweight1 Amount of loaded data 11 Time
Buffer pool setup for database load Heavyweight Buffer Lightweight Buffer > > Buffer > Sufficient buffer pool (default) Limited buffer pool (powerdown) 12 Opportunity to save energy Possible to degrade performance
Bhit(%) Bhit: possible to infer when to expand buffer pool Amount of loaded data Buffer pool size of powerdown Time Limited buffer pool (powerdown) 100 95 90 13 85 1 6 11 16 21 26 31 36 41 46 51 56 Minutes
Bhit(%) Bhit: hard to infer when to shrink buffer pool Amount of loaded data Buffer pool size of default Time 100 95 90 85 Sufficient buffer pool (default) 1 6 11 16 21 26 31 36 41 46 51 56 14 Minutes
Butil Butil: possible to infer when to shrink buffer pool Amount of loaded data Buffer pool size of default 10000 7500 5000 Sufficient buffer pool (default) Limited buffer pool (powerdown) Time Buffer pool size of powerdown 2500 0 1 6 11 16 21 26 31 36 41 46 51 56 15 Minutes
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 Bhit < 0.1% Stable Unstable 18 Shrink Expansion
Shrink: check if expansion needed Monitor Bhit and compare Threshold Bhit Monitor Butil to keep maximum as Threshold Butil Threshold Butil = max(butil) Stable Unstable 19 Shrink Expansion
Buffer pool expansion Expanding buffer pool if compromised performance Fixed Threshold Bhit to 99% for the best performance Bhit < 99% Stable Expand Unstable Unstable 20 Shrink Expansion
Expansion: waiting for being stabilized Transit to Stable if warmed up against cold misses Bhit < 0.1% Bhit < 0.1% Stable Expand Unstable Stable Unstable 21 Shrink Expansion
Expansion: check if shrink needed Move to Pre-Shrink when buffer pool looks sufficient Pre-Shrink: monitor Butil and compare Threshold Butil Stable Expand Unstable Stable Unstable Pre-Shrink Bhit 99% 22 Shrink Expansion
Buffer pool shrink Shrink buffer pool if Butil is below Threshold Butil Threshold Butil = max(butil) Bhit < 99% Stable Expand Unstable Stable Unstable Shrink Pre-Shrink 23 Shrink Butil < Threshold Butil 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 memoryboards x 4 sockets) Nehalem EX Platform A Socket A memory board 26
default configuration No memory power control One memory board Active 27 Socket 0 1 2 3
default configuration No memory power control taken by DB manager taken by other processes free OLTP workload Expanded buffer pool OS Dummy Active 28 Socket 0 1 2 3
powerdown configuration Power-down secondary memory boards taken by DB manager taken by other processes free Shrunken buffer pool 29 Socket 0 1 2 3 Active Power-down (or Inactive)
adaptive configuration Shrink Expand Socket 3 Socket 0 1 2 3 Socket 0 1 2 3 30 Active Power-down (or Inactive) taken by DB manager taken by other processes free
Joule Opportunity of energy savings Energy consumption 4.6E+05 4.3E+05-4% over Default -8% over Default 4.0E+05 3.7E+05 Default Powerdown Adaptive 31
milliseconds Adaptively retained performance Average response time 60 Default 40 20 Powerdown Adaptive 0 32
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 EECS Chang.Bae@eecs.northwestern.edu, http://www.changbae.org Jamel.Tayeb@intel.com Project website Intel Energy Checker SDK http://software.intel.com/en-us/whatif 34