an empirical study of file-system fragmentation in mobile ... · pdf filean empirical study of...

Download An Empirical Study of File-System Fragmentation in Mobile ... · PDF fileAn Empirical Study of File-System Fragmentation in Mobile Storage Systems ... the space management methods

If you can't read please download the document

Upload: dangkhuong

Post on 08-Feb-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • An Empirical Study of File-System Fragmentation in Mobile StorageSystems

    Cheng Ji1, Li-Pin Chang2, Liang Shi3*, Chao Wu1, Qiao Li3, and Chun Jason Xue1

    1Department of Computer Science, City University of Hong Kong, Hong Kong2Department of Computer Science, National Chiao-Tung University, Taiwan

    3College of Computer Science, Chongqing University, Chongqing, China*Corresponding author: [email protected]

    AbstractNowadays, mobile devices have become the necessitiesof everyday life. However, users may notice that aftera long period of usage, mobile devices will start experi-encing sluggish response. In this paper, by conductingan empirical study of filesystem fragmentation on sev-eral aged mobile devices, we found that: 1) Files maysuffer from severe fragmentation, and database files areamong the most severely fragmented files; 2) Filesys-tem fragmentation does affect the performance of mobiledevices, and the impact varies from devices to devices.Conventional defragmentation schemes do not work wellon mobile devices because they do not consider the char-acteristics specific to mobile storage. Two pilot solutionswere then suggested to enhance file defragmentation formobile devices.

    1 IntroductionMobile devices, including smartphones, tablets andwearable devices, have become the necessities of dailylife. For mobile devices, storage performance has beenidentified as a critical factor of the overall device per-formance [7]. However, recent studies reported that theunderlying flash-based storages of mobile devices are notefficiently used when the operations of file system anddatabase are combined [9]. In addition to the inefficientusage, another factor, fragmentation in file systems, hasnot been well studied in the literature.

    Fragmentation in file systems is highly correlated withthe space management methods of file systems. Asthe default file system of many mobile devices, EXT4employs extent-based allocation and delayed allocationschemes to alleviate file fragmentation. However, ourexperiments show that with EXT4 file systems, SQLitedatabase files still suffer from severe fragmentation. Aswe shall explain later, this result is closely related tohow SQLite files grow and how free space is allocatedto them.

    In this work, we conducted several studies on file

    fragmentation in mobile devices. First of all, we ex-amined how files are fragmented in several aged smart-phones with normal user usages, such as social network-ing, web browsing, and instant messaging. We foundthat files are either severely or barely fragmented, anddatabase files are among the mostly fragmented files.For example, on an one-year-old Google Nexus 5, thefile newsfeed db-journal of the Facebook applicationis fragmented into several pieces whose average size isonly 7 KB, and its fragments are widely dispersed over arange of 1.5 GB storage space.

    Next, we evaluated how file fragmentation impacts I/Operformance, and identified at least two reasons for I/Olatency degradation: First, accessing fragmented files re-sults in frequent block I/Os, which accumulate a largetime overhead on the I/O path. Second, file fragmenta-tion incurs highly dispersed I/O patterns, which dimin-ish spatial localities. To enable efficient random accesswith limited resource, flash storages may adopt demand-based caching of the page-level mapping table. Access-ing highly fragmented files imposes high overhead onthe management of the mapping cache and amplifies thelatencies of block reading and writing.

    Conventional disk defragmentation methods are con-sidered harmful to flash memory because they involveintensive data copy. They do not proactively avoid filefragmentation either. To the best of our knowledge, nofile defragmentation schemes have been proposed formobile devices. Finally, we suggested two pilot solutionswith the consideration of the flash management overheadand file access characteristics in mobile storage systems.

    This study makes following contributions: 1) We i-dentified that file fragmentation is a serious problem inmobile devices, and SQLite database files were amongthe mostly fragmented files. 2) We evaluated how ap-plication performance of mobile devices can be affectedby fragmentation in mobile devices; 3) We suggested twopilot solutions to optimize file defragmentation in mobiledevices.

  • 2 Background and Related Work2.1 Fragmentation in File SystemsFile systems, including EXT4, FAT, and even the log-structured file system, F2FS, suffer from fragmentation.Fragmentation in file systems is caused by the agingproblem [12], and it emerges when the file system cannotfind continuous free space for files. Take EXT4 as anexample, which is the default file system since Androidversion 4.0.4, it suffers from three types of fragmenta-tion: single file fragmentation, relevant file fragmenta-tion, and free space fragmentation [11]. These types offragmentation did affect the performance of hard diskdrives [4]. However, there is little work targeting on howthey affect the performance of mobile storage systems.

    2.2 Conventional DefragmentationPrevious studies propose to restore the continuity of frag-mented files through re-locating file fragments to a con-tinuous free space. The DFS [2] file system proacti-valy performs file defragmentation when severe frag-mentation is detected. EXT4 employs a user-mode tool,e4defrag [11], to defragment files in an on-demandmanner. Defragmenting Solid-State Disks (SSDs) ofdesktop computers was reported having little effect andeven considered harmful to SSD lifetime [6]. Howev-er, applications in smartphones exhibit very unique fileaccessing behaviors, and the design of flash storage forsmartphones is resource conservative. We observed thatfragmentation is a serious problem in smartphones andit noticeably affects the performance of file accessing onflash storage.

    3 Fragment Measurement SetupIn this section, we present the setups for our fragmenta-tion study including the mobile platforms, measurementsoftwares and benchmarks.

    3.1 Smartphone PlatformsOur study is based on four Android phones, includingGoogle Nexus 5, Google Nexus 6, Huawei Honor 6,and Huawei Ascend P7. These phones were from ran-domly selected people to avoid potential biases. Thesephones had underwent at least six months of daily use oftheir owners. The use patterns of these phones involvedcommon Android user activities, including web surfin-g, sending/receiving emails, social networking, instantmessaging, and taking pictures. These activities werebased on popular Android applications, including Face-book, Twitter, WeChat, Chrome, Gmail, Google Earth,and the built-in applications like Camera. Observationsand experiments regarding file fragmentation were con-ducted on the Android data partition, which was for-matted in EXT4. The data partition sizes of the selectedphones were 26.8, 26.0, 11.6 and 11.8 (GB), respectively.

    Upon the arrivals of these phones, the file system utiliza-tions of their data partitions were 93%, 57%, 44%, and90%, respectively.

    3.2 Measurement Softwares and Applica-tion Benchmarks

    e4defrag is used for inspecting the file fragmentationand performing file defragmentation if needed. To man-ually execute SQL statements on a SQLite database, weuse the command-line utility sqlite3. To study the I/Opattern of the fragmented files, we use blktrace to col-lect block-level traces for device I/O and use MOST [5] toidentify the source file of each I/O request.

    Several popular Android applications, including Face-book, Twitter, WeChat and Google Earth are used toassess the impacts of fragmentation. With these appli-cations, we read news feed, chat with friends, and viewonline satellite maps for one minute, respectively.

    4 Characteristics of FragmentationIn this section, we characterize fragmentation in Androiddevices. Degree of Fragmentation (DoF) is used to repre-sent the degree of single file fragmentation. DoF is com-puted by Equation 1, where next is the current numberof extents and nlowest ext is the ideal (smallest) numberof extents of the file, respectively. The larger the DoFis, the more serious the fragmentation is. In the follow-ing, fragmentation is analyzed against file types and filesystem utilizations.

    DoF = next/nlowest ext (1)

    Fragmentation vs. File Types: We examined thefragmentation of different types of files using the smart-phones described in Section 3.1. Figure 1 shows the DoFof database files (with extensions .db, .db-journal,and .wal), executable files (with extensions .apk, .dex,.odex, and .so) and all files. We found that the file frag-mentation has two extremes: most of the executable filesare barely fragmented, while the database files, especial-ly those with the .db and .db-journal extensions, areseverely fragmented.

    We are particularly interested in the fragmentation ofdatabase files, because they contribute to about 70% ofall block writes in Android devices [9]. We examined thesingle file fragmentation of database files from a selectedset of Android applications on the Google Nexus 5. Asshown in Figure 2(b), almost all the database files areseverely fragmented. Particularly, each of the databasefile of Facebook is fragmented into four pieces on aver-age (47 files have 162 fragments). Most fragmented filesare those with extensions .db and .db-journal, andtheir fragment sizes range from tens to hundreds of kilo-bytes. This is because when database files are appendedwith new data, record by record, an aged file system can

    2

  • 0

    1

    2

    3

    4

    5

    Nexus 5 Nexus 6 Honar 6 P 7De

    gre

    e o

    f F

    rag

    me

    nta

    tio

    n SQLite Executable Overall

    (a)

    Revisiting Defragmentation for Mobile Storage Systems

    app Files Fragments Average SizeFacebook 47 162 26 KB

    Twitter 14 83 55 KBWechat 6