Improving File System Performance of Mobile Storage Systems Using A
Total Page:16
File Type:pdf, Size:1020Kb
Improving File System Performance of Mobile Storage Systems Using a Decoupled Defragmenter Sangwook Shane Hahn, Seoul National University; Sungjin Lee, Daegu Gyeongbuk Institute of Science and Technology; Cheng Ji, City University of Hong Kong; Li-Pin Chang, National Chiao-Tung University; Inhyuk Yee, Seoul National University; Liang Shi, Chongqing University; Chun Jason Xue, City University of Hong Kong; Jihong Kim, Seoul National University https://www.usenix.org/conference/atc17/technical-sessions/presentation/hahn This paper is included in the Proceedings of the 2017 USENIX Annual Technical Conference (USENIX ATC ’17). July 12–14, 2017 • Santa Clara, CA, USA ISBN 978-1-931971-38-6 Open access to the Proceedings of the 2017 USENIX Annual Technical Conference is sponsored by USENIX. Improving File System Performance of Mobile Storage Systems Using a Decoupled Defragmenter Sangwook Shane Hahn, Sungjin Lee†, Cheng Ji∗, Li-Pin Chang‡, Inhyuk Yee, Liang Shi§, Chun Jason Xue∗, and Jihong Kim Seoul National University, †Daegu Gyeongbuk Institute of Science and Technology, ∗City University of Hong Kong, ‡National Chiao-Tung University, §Chongqing University Abstract Step 1: examine the need and effect of In this paper, we comprehensively investigate the file file defragmentation. (See Section 2.) fragmentation problem on mobile flash storage. From Step 2: extract the design requirements of our evaluation study with real Android smartphones, we a defragger for flash storage. (See Section 3.) observed two interesting points on file fragmentation on Step 3: design and implement a defragger flash storage. First, defragmentation on mobile flash that meets the requirements. (See Section 4.) storage is essential for high I/O performance on Android Fig. 1: A summary of the key steps in our investigation. smartphones because file fragmentation, which is a re- curring problem (even after defragmentation), can signif- operations, it is believed that the effect of defragmenta- icantly degrade I/O performance. Second, file fragmen- tion on the file system performance is rather negligible tation affects flash storage quite differently than HDDs. for flash storage. Furthermore, since a large number of When files are fragmented on flash storage, the logi- files need to be copied during defragmentation, frequent cal fragmentation and the physical fragmentation are de- defragmentation can affect the limited lifetime. How- coupled and a performance degradation mostly comes ever, this negative view toward flash defragmentation has from logical fragmentation. Motivated by our obser- been widely accepted without a proper validation study. vations, we propose a novel defragger, janus defragger The main goal of this paper, therefore, is to investigate (janusd), which supports two defraggers, janusdL for a the file fragmentation problem on mobile flash storage in logical defragger and janusdP for a physical defragger. a systematic and comprehensive fashion. Fig. 1 summa- JanusdL, which takes advantage of flash storage’s inter- rizes the key steps of our investigation study. nal logical to physical mapping table, supports logical Since previous studies (e.g., [22]) have shown that files defragmentation without data copies. JanusdL is very can be severely fragmented on mobile flash storage, in effective for most fragmented files while not sacrificing our study, we start with two key questions related to the the flash lifetime. JanusdP, which is useful for physi- effect of file defragmentation (step 1 in Fig. 1): 1) when cally fragmented files but requires data copies, is invoked fragmented files are defragmented, how much I/O per- only when absolutely necessary. By adaptively selecting formance is improved? and 2) how long does the effect janusdL and janusdP, janusd achieves the effect of full of file defragmentation last? Unlike a common miscon- file defragmentation without reducing the flash lifetime. ception on flash defragmentation, our evaluation study Our experimental results show that janusd can achieve at showed that I/O performance of flash storage can be sig- least the same level of I/O performance improvement as nificantly improved by defragmentation. For example, e4defrag without affecting the flash lifetime, thus mak- when fragmented files were defragmented, the average ing janusd an attractive defragmentation solution for mo- app launching time, which is an important user-perceived bile flash storage. performance metric on smartphones, can be improved by up to 52% over the fragmented files. 1 Introduction Although fragmented files can degrade the I/O perfor- When a file system becomes highly fragmented, it has mance, if the effect of file defragmentation can last for to allocate multiple split storage areas, i.e., extents [1], long time (e.g., several months), a conventional defrag- for a single file more frequently. In an HDD-based file mentation tool will be sufficient. However, our evalua- system, accessing such a highly-fragmented file degrades tion study indicated that file fragmentation may recur in the performance significantly due to the increased time- a short cycle, around a week, even after full file defrag- consuming seek operations. In order to mitigate the per- mentation on smartphones. One main cause of recurring formance impact caused by file fragmentation, many file file fragmentation was frequent automatic app updates systems recommends the periodical execution of the de- on smartphones. Since many popular apps tend to be up- fragmentation utility (e.g., every week) [2-6]. dated very frequently (e.g., every 10 days [28]), the effect Unlike for HDD-based file systems, defragmentation of file defragmentation quickly disappears. is generally not recommended for flash-based file sys- When file defragmentation is repeatedly required, a tems [7-13]. Since flash storage does not require seek conventional defragger such as e4defrag may not be an USENIX Association 2017 USENIX Annual Technical Conference 759 appropriate solution for flash storage because it requires defragger is necessary because a logical defragger cannot a large amount of data copies during defragmentation, even identify physically fragmented files. thus seriously affecting the flash lifetime. For example, Motivated by the above requirements on a defragger if we invoke e4defrag every week as suggested from our for mobile flash storage, we propose a novel decou- evaluation study, it might reduce the flash lifetime by pled defragger, janusd, which consists of two defraggers, more than 10%. Therefore, in order to maintain high I/O janusdL for a logical defragger and janusdP for a phys- performance in a sustainable fashion, we need a differ- ical defragger (step 3 in Fig. 1). JanusdL, which takes ent approach to the defragmentation problem for mobile advantage of flash storage’s internal logical to physical flash storage, so that the impact of file defragmentation mapping table, supports logical defragmentation with- on the flash lifetime is less adverse. out reducing the flash lifetime by avoiding explicit data The key insight behind janus defragger (janusd) copies. JanusdP, which independently operates from comes from our investigation on the characteristics of janusdL, works like a conventional defragger with data file fragmentation in flash storage (step 2 in Fig. 1). Our copies. Since the I/O performance of flash storage is study showed that file fragmentation affects flash storage dominated by logical file fragmentation, janusdL works quite differently from HDDs. In HDDs, when a (logi- very well for most fragmented files without affecting the cal) file is highly fragmented, its physical layout is frag- flash lifetime. On a rare occasion when a file is physi- mented similarly with many isolated physical fragments. cally fragmented, janusdP is invoked to restore the de- That means, logical fragmentation at the file system and graded file performance. physical fragmentation at the storage medium level are In order to validate the effectiveness of the proposed highly correlated. On the other hand, in flash storage, janusd technique, we have implemented janusd on an there is no physical counterpart at the storage medium emulated mobile flash storage, simeMMC and simUFS. level which is strongly correlated with logical fragmenta- (SimeMMC and simUFS, which are based on an extended tion at the file system. For example, unlike HDDs where Samsung 843T SSD which supports host-level FTLs, a degree of logical fragmentation directly affects the I/O are configured to effectively simulate the bandwidth of performance at the storage medium level, the I/O per- eMMC and UFS devices [14, 15], respectively.) Our formance at the storage medium level in flash storage experimental results show that janusd significantly im- is largely decided by an average degree of the I/O par- proves the I/O performance of mobile flash storage. For allelism during I/O operations [16-21]. As will be ex- example, janusd can reduce the app launching time by plained in Section 3, since the average degree of the I/O up to 53%, achieving an equivalent I/O performance im- parallelism for accessing a file is not correlated with the provement as e4defrag. However, janusd requires a less degree of logical fragmentation of the file, file fragmen- than 1% of data copies over e4defrag, thus making it tation in flash storage occurs in a decoupled fashion be- an attractive defragmentation solution for flash storage. tween the logical space and the physical space. (In this Furthermore, janusdL alone achieves about 97% of the paper, we call that a file foo is physically fragmented janusd’s performance level for most files. when the degree of the I/O parallelism in accessing foo The remainder of this paper is organized as follows. In is limited.) Section 2, we report our key findings through our evalu- In order to understand the impact of decoupled frag- ation study of real-world file fragmentation on Android mentation on I/O performance, we evaluated the perfor- smartphones. Section 3 describes decoupled fragmen- mance impact of file fragmentation on the entire mobile tation in flash storage and explains needs for both log- I/O stack layers. As expected, because of a high degree ical and physical defraggers.