Download presentation
Presentation is loading. Please wait.
Published bySydney George Modified over 9 years ago
1
© 2006 IBM Corporation Adaptive Self-Tuning Memory in DB2 Adam Storm, Christian Garcia-Arellano, Sam Lightstone – IBM Toronto Lab Yixin Diao, M. Surendra – T.J. Watson Research Center IBM Toronto Lab VLDB 2006 | Seoul, Korea | September 13, 2006
2
Adaptive Self-Tuning Memory | VLDB 2006 | Seoul, Korea © 2006 IBM Corporation 2 The Memory Tuning Problem Tuning the memory for an industrial RDBMS can be costly –Time consuming even for advanced users due to trial and error methods Skill in memory tuning is difficult to find Given a workload, determining memory requirements is difficult –Educated “trial and error” is state-of-the-art tuning method Any static configuration may be sub-optimal for dynamic workloads Effect on performance can be huge –Orders of magnitude
3
Adaptive Self-Tuning Memory | VLDB 2006 | Seoul, Korea © 2006 IBM Corporation 3 Previous Approaches to Memory Tuning Wealth of previous approaches in the literature –Can be broadly divided into “Academic” and “Industrial” approaches Academic Approaches –Sound theoretically, but can be difficult to implement –Hit rate estimations, assumptions on hit rate curve –In some cases, adding memory may create steps in the HR curve –Response time goals –Focused on one type of memory in isolation –Difficult to integrate several solutions into one comprehensive tuner Industrial Approaches –Difficult to discern inner workings –Oracle –Unable to automatically determine value for total database memory usage –Can’t tune buffer pools which store pages larger than 4KB or trade memory between buffer pools and sort –Microsoft –Is able to automatically determine value for total database memory usage –Doesn’t appear to have sophisticated memory distribution algorithm
4
Adaptive Self-Tuning Memory | VLDB 2006 | Seoul, Korea © 2006 IBM Corporation 4 DB2’s Self Tuning Memory Manager (STMM) Innovative cost-benefit analysis –Simulation technique vs. modeling Tunes memory distribution and total memory usage Simple greedy memory tuner Control algorithms to avoid oscillations Performs very well in experiments –For both OLTP and DSS
5
Adaptive Self-Tuning Memory | VLDB 2006 | Seoul, Korea © 2006 IBM Corporation 5 Cost-Benefit Analysis How can memory requirements of one consumer be compared against another –Memory consumers can operate in drastically different ways –Buffer pools spend time doing I/O; Sort can uses I/O and CPU –Need a common metric Metric chosen: simulated seconds saved memory required (in 4 KB pages) Allows for comparison between different memory consumers Calculated differently for each consumer using simulation techniques –Technique ensures accuracy of data
6
Adaptive Self-Tuning Memory | VLDB 2006 | Seoul, Korea © 2006 IBM Corporation 6 Buffer Pool Benefit Analysis Technique simulates adding pages to the buffer pool As pages are removed from buffer pool they are placed in the Simulated Buffer Pool eXtension (SBPX) –SBPX only requires page descriptor and not page data so memory requirements are small When miss occurs on page read, SBPX is consulted If page is found in SBPX, physical read would have been avoided if the SBPX contained real pages For each miss found in SBPX, cost of physical I/O is timed –Allows for detection of asymmetrical read times –(Cumulative time saved) / (Size of SBPX) is the benefit of adding pages to the buffer pool
7
Adaptive Self-Tuning Memory | VLDB 2006 | Seoul, Korea © 2006 IBM Corporation 7 SBPX Operation Buffer Pool SBPX Disk 3. Page request for 4. Check Bufferpool 5. Check SBPX 6. Start timer 1. Victimize Page (move to SBPX)2. Load new page from disk7. Victimize BP page (send to SBPX) 8. Load page from disk 9. Stop timer
8
Adaptive Self-Tuning Memory | VLDB 2006 | Seoul, Korea © 2006 IBM Corporation 8 Compiled SQL Cache Benefit Similar to buffer pool approach but Simulated SQL Cache eXtension (SSCX) stores compressed compiled SQL packages When a package is not found in SQL Cache, SSCX is consulted If package is found in SSCX then cost of query compilation is timed (Cumulative time saved) / (Size of SSCX) is the benefit of adding pages to the SQL Cache
9
Adaptive Self-Tuning Memory | VLDB 2006 | Seoul, Korea © 2006 IBM Corporation 9 What about cost? Only discussed benefit calculations –How can cost be calculated? For the caches (buffer pools, SQL cache) it is possible to simulate cost but the simulation method is cost prohibitive –Extra computation on a miss is dwarfed by read time – not so with hits –In these cases we approximate cost as the inverse of benefit –If growth by 10 pages saves 5 seconds, shrinking by 10 pages will incur and additional 5 seconds of computation time –Can be a crude approximation (i.e. when benefit is 0) but works well in practice In some other cases (ex. Sort) we can inexpensively determine an accurate cost
10
Adaptive Self-Tuning Memory | VLDB 2006 | Seoul, Korea © 2006 IBM Corporation 10 Greedy Memory Tuner Simply takes memory from consumers with low cost and gives it to consumers with high benefit Is able to determine how much memory to take from the OS based on free memory usage statistics –Tries to maintain some free physical memory at all times –Uses more memory (or frees up memory) based on current free physical memory and database’s free memory target –See paper for more detail Has sleep/wake periods –Automatically adapted at run-time
11
Adaptive Self-Tuning Memory | VLDB 2006 | Seoul, Korea © 2006 IBM Corporation 11 Control Algorithms Help reduce tuning oscillations Used for two purposes –To control the amount of memory moved in each interval –To determine how much time to sleep between tuning intervals Controlling the amount of memory moved –Two different algorithms (MIMO and Oscillation Dampening) –MIMO (Multiple Input Multiple Output) –Fits historical cost-benefit data to a curve –Uses curve to estimate distance from optimal memory configuration –Sets resize amount for optimal configuration in ~20 intervals –Oscillation Dampening –Used before MIMO model can be generated –Uses resize patterns to detect the presence of oscillations Determining sleep time Much more detail in the paper
12
Adaptive Self-Tuning Memory | VLDB 2006 | Seoul, Korea © 2006 IBM Corporation 12 Experimental results – tuning a static workload BP Size
13
Adaptive Self-Tuning Memory | VLDB 2006 | Seoul, Korea © 2006 IBM Corporation 13 Experimental results – workload shift
14
© 2006 IBM Corporation Adam Storm ajstorm@ca.ibm.com
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.