450 likes | 577 Views
The Ohio State Universit y, USA. Wayne State University, USA. SmartSaver: Turning Flash Drive into a Disk Energy Saver for Mobile Computers. Feng Chen 1 Song Jiang 2 Xiaodong Zhang 1. Disks Cost High Energy in Mobile Computers. Battery life is always limited to mobile computers.
E N D
The Ohio State University, USA Wayne State University, USA SmartSaver: Turning Flash Drive into a Disk Energy Saver for Mobile Computers Feng Chen1 Song Jiang2Xiaodong Zhang1
Disks Cost High Energy in Mobile Computers • Battery life is always limited to mobile computers. • Hard disks account for a considerable amount of energy consumption in mobile computers, such as laptops. • Efforts to save disk energy is limited by its mechanics • High disk energy consumption mainly stems from rotational disk platters.
Hard Disk Energy Consumption States • Four power consumption states • Active – reading/writing/seeking • Idle – disk platters keep spinning, electricity is partially powered down • Standby – disk platters are spun down, and disk arms are parked • Sleep – remaining components powered off • How to save disk energy? • Switch from high energy consumption state (Active/idle) to lower energy consumption state (standby).
Active State Active State Disk is idle for 20 seconds, spin it down Receive request #2, spin up disk Idle State Idle State Receive request #1 Disk sleeps and energy is saved Standby State Standby State Energy Consuming Cycles • Once the hard disk is idle for a specific period (timeout threshold), disk is spun down to save energy • Upon arrival of a request, disk is spun up to serve the requests. • Spin up/down disk raises substantial energy and time overhead 2.0 1.6 Energy Consumption (W) 0.15 0.0 0 1 2 22 38 39 Time (second)
Flash Drive is Low Energy Device • A portable storage device for almost every mobile computer user on the road • Features • Low cost • Compact size • Nonvolatile storage – not as dynamic as main memory • No mechanical components – not as slow as disk • Low power consumption • E.g. Active Power: 0.024w (flash) vs. 0.624w (disk): 26 times! • The power difference for standby mode is 2500 times. • Unfortunately, the flash drive is still mainly used for file transfer and temporary storage. Our goal --- using the low-cost and low energy flash drive to save disk energy
Main idea • SmartSaver uses flash memory to cache and prefetch disk data to be reused and used later. • Two-fold goals • Effectively extend disk idle periods and save disk energy • Optimize flash drive usage by effectively caching and prefetching the useful data.
Outline • Issues and Challenges • Scheme Design • Performance Evaluation • Conclusion
Issues and Considerations • Two characteristics of the flash drive • Low write bandwidth • Only 8MB/sec for Transcend TS1GJF2A flash drive • Limited erasure/rewrite cycles • Typically 100,000 overwrites • Design considerations • These two specifics are in our design consideration
An Intuitive Idea “Baseline” (MarSh’94) • Insert the flash drive between main memory and the hard disk as a new layer in the storage hierarchy. • Cache every byte loaded from disk or evicted from main memory • Uses LRU to free space when the flash drive is full • Accesses to disks are hoped to be absorbed by flash drive Main memory Main memory Flash drive Disk Disk
Four Ignored Issues in ``Baseline” • Flash drive does not fit well in the storage hierarchy. • Flash drive w/ low write bandwidth would become a bottleneck • One-time access data should not be cached at all • It caches everything including one-time accessed data. • Data should be selectively cached in flash drive • Data w/ good locality – frequently reused data • Data w/ high energy consumption – data that move slowly from/to the disk and keep disk active for a long period • Data should be replaced carefully • Hold data w/ good locality or high energy consumption
SmartSaver Design • A flash drive is into three areas for: • Caching • Prefetching • Writeback • The data allocations to the areas are balanced and adaptive. Main memory Caching Prefetching writeback Disk read write
Busy period quiet period Busy Period and Quiet Period • Busy period • between the disk spin-up and its consecutive spin-down • Quiet period • between the disk spin-down and its consecutive spin-up Active State Active State 2.0 1.6 Idle State Idle State Energy Consumption (W) 0.15 Standby State 0.0 0 1 2 22 38 39 Time (second)
Busy period quiet period quiet period Active State Idle State SmartSaver Extends Disk Quiet Period • The goal is to minimize busy periods by serving requests using data in the flash drive • The longer busy periods are reduced, the more energy could be saved. Active State 2.0 1.6 Idle State Energy Consumption (W) 0.15 Standby State 0.0 0 1 2 22 38 39 Time (second)
SmartSaver Task 1: Caching • Caching two types of data in flash drive • Frequently used data • Disk data with high thinking time. • Comparisons of thinking times • Gzip– 10 seconds to compress one file • Glimpse – 1 minute to build index for the same file • Caching the file generated by Glimpse can save more energy than that by gzip.
Energy Saving Rate (ESR) • Es = Energy (Jr) that could be saved if one busy period is avoided (proportional to the thinking time) • Bd = Data bytes accessed during the busy period • ESR = Es / Bd (energy consumption per Byte) • For example, ESR (Glimpse) > ESR (gzip) • ESR • describes how much energy could be saved by caching one chunk of data in flash drive by avoiding its busy period.
Envelope: A Mechanism to Monitor Disk Energy Usage • Envelope – a data structure to monitor accessed data blocks during a busy period. • An envelope is created in each completed busy period. • Upon a completion of a busy period, its ESR value is calculated for its envelope. • Blocks accessed during a busy period are recorded in its envelope in the LRU order. • If one envelope is selected based on two factors, all its data blocks are written to the flash drive. • Cached envelopes are placed in a queue, called envelope stack.
quiet period 12 12 11 Busy period Busy period 4 2 1 4 12 2 11 LRU LRU 1 Envelope5 Envelope6 Enevelope 10 Logic Block Number 5 0 50 0 1 2 22 80 Time (second)
Flash Drive Replacement • Energy-saving-oriented Replacement • A block’s value for energy saving • How much energy could be saved • How likely it is to be reassessed • Challenge • how to evaluate and compare two blocks’ values for energy saving simultaneously using these two orthogonal metrics? • Envelope stack is used to achieve the goals.
Global inflation value L (how likely the envelope could be reaccessed) (H=85, ESR=45, L=40) 43 9 (H=75, ESR=50, L=25) Envelope9 (ESR=25) (H=70, ESR=60, L=10) (H=55, ESR=50, L=5) H = ESR + L Envelopes sorted in ascending order of H Envelope’s ESR value (how much energy could be saved) A global inflation value w/ initial value 0 and keeps inflated, (the H value of the last replaced envelop). Step 1: use the H value of Envelop5 to inflate L value Replace Envelope5 at the stack bottom 55 17 Envelope8 15 11 10 Envelope7 5 4 2 Envelope6 1 12 L=40 Envelope5 11 Envelope Stack
43 Envelope9 (H=80, ESR=55, L=55) 9 43 9 10 (H=75, ESR=50, L=25) Envelope7 5 Envelope9 (ESR=25) 4 H= ESR+L=80 (H=70, ESR=60, L=10) 2 Envelope6 Step 3: Calculate H value of new envelope9 using the up-to-date L 1 12 (H=55, ESR=50, L=5) Envelope5 11 55 Step 4: insert envelope9 into the envelope stack according to its H value 17 (H=85, ESR=45, L=40) Envelope8 15 11 Envelope9 (ESR=25) L=55 Step 2: reclaim envelope5 Envelope Stack
SmartSaver Task 2: Prefetching • Goal • Preload long sequential disk accesses (such as video streams) in the beginning of the sessions. • Enlarge the disk quiet periods. • Issues • How to identify sequential access patterns • How to avoid inefficient prefetching decisions • How to coordinate prefetching with other concurrent disk events
Identifying Sequential Access Patterns • Objective • Avoid intrusive changes to existing performance-critical buffer cache management in OS kernels • Existing Linux file-level prefetching mechanism • Two read-ahead windows to detect the sequential file accesses • Windows are expanded, if accesses is sequential • Windows are shrunk, if accesses become random • Indirect pattern detection mechanism • Monitor changes of window sizes • If windows are enlarged to its maximum size (32 pages), initiate a prefetching stream • If windows are shrunk, terminate a prefetching stream
Task 3: Writeback via Flash Drive • Goal • In most OS kernels, dirty blocks are periodically flushed back to the disk to avoid losing data in volatile memory • Linux writes dirty blocks older than 30 sec back every 5 sec. • Such periodical disk accesses conflict with disk energy saving • Solutions: • If the disk is in the standby state, SmartSaver redirect writeback traffic to the flash drive; otherwise, dirty blocks are directly written to the disk. • If the disk is back to the active state and 90% of the writeback area is full, all the dirty blocks are written back to the disk. • If the writeback area is overflowed, the disk is spun up to write back all the dirty blocks.
Balancing the three areas • Goal • As the flash drive is partitioned into three areas, tuning the sizes of three areas on-line is desired to achieve optimal energy saving • Solution • SmartSaver monitors accesses to each area and periodically evaluates the amount of energy saved due to the addition of N blocks. • Each time N blocks are reclaimed from the least “productive” area, where adding N more blocks can achieve less increased energy saving than adding them to other areas, and allocated to the most “productive” one.
Trace-driven Simulation Evaluation • Simulating major linux kernel components • 2Q-like memory page replacement algorithm • Two-window file prefetching scheme • I/O request clustering mechanism • Three disk energy-saving schemes are simulated • Linux laptop mode (Linux) • Baseline flash-memory-based scheme (Baseline) • Our disk energy-saving scheme (SmartSaver)
Simulated disk • HITACHI-DK23DA hard disk • 30GB • 4200RPM • 35MB/sec peak bandwidth • Avg. seek time: 13.0 ms • Avg. rotation time: 7.1 ms • Timeout threshold: 20 sec Table 1. Energy-related parameters
Simulated Flash drive • Transcend TS1GJF2A flash drive • Read bandwidth: 12MB/sec • Write bandwidth: 8MB/sec • Active power consumption: 0.365W • Sleep power consumption: 0.6mW
Traces • Strace utility • Modified strace utility can intercept all file-operation related system calls, e.g. read(). • Collected info: PID, file descriptor, inode number, offset, size, type, timestamp, and duration • Blocks of traced files are sequentially mapped to a simulated disk with small random distance between files
Traces • 8 traces of 7 typical applications used in a mobile computing environment are collected. • 5 single-application traces • 2 multi-application traces • 2 typical mobile computing senarios are generated by concatenating individual application traces one by one • Programming • Networking Table 2. Description of traces
Case-1 : programming • The Programming scenario is composed of eight stages • Make, Grep, xmms, make, grep, Scp-r, make, grep
Linux w/ 64MB memory –89.1% disk idle periods are not long enough (<16sec ) for saving disk energy Linux w/ 128MB memory -- 73.3% idle periods are shorter than 16 sec. Baseline w/ 64MB memory and 128MB flash – 79.3% idle periods are shorter than 16 sec. SmartSaver w/ 64MB memory and 128MB flash drive – only 30.8% disk idle periods are invalid for energy saving Disk break-even time (16 seconds) – if disk is idle < 16 sec, NO energy could be saved. Case-1 : programming • Unusable Idleness Percentage (UIP) • the lower a UIP is, the more energy could be saved • SmartSaver can effectively extend disk idle time longer than the disk break-even time.
SmartSaver writes 46.6% less data to the flash drive than Baseline, but reads 50% more data from the flash drive. SmartSaver saves 41.0% more energy than Linux Case-1 : programming • SmartSaver achieves better energy conservation • SmartSaver uses the flash drive more efficiently
Linux cannot accommodate the working-set in memory, thus, Linux has disk accesses at all eight stages Baseline flushes working-set of “make” andcaches the working-set of “scp-r” in the flash drive. SmartSaver starts prefetching for “xmms”. SmartSaver caches the working-set of “make”. Baseline caches the working-set of “make” in the flash drive, thus, disk is idle for 822 seconds at stage 4 and 5. SmartSaver protects the working-set of “make” from being evicted by “scp-r”. Disk is idle and “make” is satisfied in the flash drive. Disk has to be spun up for “make” again. Case-1 : programming • Disk I/O activities of three schemes w/ 64MB memory and/or 128MB flash drive
Case-2 : networking • The networking scenario is composed of three stages Scp-mplayer, ftp-mplayer • Thunderbird,
Linux & Baseline – around 73% disk idle times are too short to save disk energy SmartSaver w 128MB flash drive – only 16.7% disk idle times are shorter than 16 sec. Case-2 : networking • Baseline cannot extend disk idle time, as the disk activities are dominated by one-time accesses. • SmartSaver effectively extends disk idle time through prefetching
SmartSaver saves 41.8% more energy than Linux SmartSaver writes 22.8% less data to the flash drive than Baseline, but reads 707.6% more data from the flash drive. Case-2 : networking • SmartSaver achieves better energy conservation • SmartSaver uses the flash drive more efficiently
SmartSaver does not prefetch for both “scp”, whose data consumption rate is 8MB/sec, and “mplayer”, since disk keeps active. Baseline cannot deal with the one-time access dominated workload. After “scp” completes, SmartSaver prefetches for mplayer. In contrast, SmartSaver prefetches for “ftp” and mplayer”, both of which have a low consumption rate. Case-2 : networking • Disk I/O activities of three schemes w/ 64MB memory and/or 128MB flash drive
Implementation Related Discussion • Overhead of inserting envelope into the stack • Only one insert sort operation per busy period, which is usually minutes long. • Overhead is amortized over all accessed data blocks • Wear-leveling • SmartSaver does not conduct its own wear-leveling • SmartSaver saves limited erasure cycles by reducing amount of data written to the flash drive, rather than creating even distribution of data written over the flash drive. • SmartSaver is complementary to existing wear-leveling techs • Data integrity • Dirty blocks could be flushed back to the disk when disk is active • Mandatory write back of dirty blocks before detaching flash drive
Conclusion • We identify some critical issues involved in using the flash drive for saving disk energy • We designed a comprehensive set of solutions to maintain an effective use of the flash drive to achieve three goals • Accommodating the unique prosperities of the flash drive • Minimizing intrusive OS kernel changes • Significantly improving disk energy saving • Trace driven simulations for typical mobile computing scenarios show SmartSaver can save up to 41.8% disk energy compared with existing policies in Linux.
Reference • [1] Intel. Intel mobile platform vision guide for 2003 • [2] P.Cao and S. Irani. Cost-aware www proxy caching algorithms.USENIX’97 • [3] A.E. Papathanasiou and M. L. Scott. Energy efficient prefetching and caching. USENIX’04 • [4]F. Douglis, P. Krishnan, and B. Marsh. Thwarting the power-hungry disk. In Proc. of USENIX’94, Jan. 1994. • [5]F. Douglis, P. Krishnan, and B. Bershad. Adaptive disk spin-down policies for mobile computers. In Computing Systems, volume 8(4), pages 381–413, 1995. • [6]D. P. Helmbold, D. D. E. Long, and B. Sherrod. A dynamic disk spin-down technique for mobile computing. In Proc. of the 2nd Annual International Conference on Mobile Computing and Networking, 1996. • [7]A. Weissel, B. Beutel, and F. Bellosa. Cooperative io – a novel io semantics for energy-aware applications. In Proc. of OSDI’02, Dec. 2002. • [8]S. Gurumurthi, A. Sivasubramaniam, M. Kandemir, and H. Franke. Drpm: Dynamic speed control for power management in server class disks. In Proc. of ISCA’03, 2003. • [9]B. Marsh, F. Douglis, and P. Krishnan. Flash memory file caching for mobile computers. In Proc. of the 27th Hawaii Conference on Systems Science, Hawaii, 1994. • [10]T. Bisson and S. Brandt. Reducing energy consumption with a non-volatile storage cache. In Proc. of International Workshop on Software Support for Portable Storage, San Francisco, CA, March 2005. • [11]E. B. Nightingale and J. Flinn. Energy-efficiency and storage flexibility in the blue file system. In Proc. of OSDI’04, SF, CA, Dec. 2004. • [12]F. Zheng, N. Garg, S. Sobti, C. Zhang, R. E. Joseph, A. Krishnamurty, and R. Y. Wang. Considering the energy consumption of mobile storage alternatives. In Proc. of MASOCTS’03, Oct. 2003.
Step 4: Insert envelope9 to envelope stack 55 17 Envelope8(H=85, ESR=45, L=40) 15 43 11 9 10 Envelope7(H=75, ESR=50, L=25) 5 Envelope9 (ESR=55, L=55) H= ESR+L=110 4 2 Envelope6(H=70, ESR=60, L=10) Step 3: Calculate H value of new envelope9 1 12 L=55 Envelope5(H=55, ESR=50, L=5) 11 Step 1: Reclaim victim envelope5 Step 2: Update L value with H (55) of envelope5 Envelope Stack
Measurement of period length of active disk state • Disk Active State • Transfer time – sizeof (request) / bandwidth • Rotation time – random(0-14.2ms) • Seek time – a seek profile generated from real disk trace Figure 1. Seek profile
Case-2 : networking • The networking scenario is composed of eight stages • Thunderbird, scp-mplayer, and ftp-mplayer
Linux-128: 73.3% Baseline-64-128: 79.3% Linux-64: 89.1% Linux-256: 57.2% SmartSaver-64-128: 30.8% Case-1 : programming • Unusable Idleness Percentage (UIP) • the lower a UIP is, the more energy could be saved • SmartSaver can effectively extend disk idle time longer than the disk break-even time.