
Prediction of Optimal Readahead Parameter in Linux by Using Monitoring Tool Ekaterina Gorelkina Sergey Grekhov SRC Moscow, Samsung Electronics SRC Moscow, Samsung Electronics [email protected] [email protected] Jaehoon Jeong Mikhail Levin SAIT, Samsung Electronics SRC Moscow, Samsung Electronics [email protected] [email protected] Abstract this paper has a very good facilities to be widely and simply used for embedded applications optimization to Frequently, application developers face to the hidden increase their quality and effectiveness. performance problems that are provided by operating system internal behavior. For overriding such problems, 1 Introduction Linux operation system has a lot of parameters that can be tuned by user-defined values for accelerating the sys- In modern computing systems high performance disk tem performance. However, in common case evaluating drive systems very often have a serious problem related of the best system parameters requires a very time con- with its performance, effectiveness and speed. Usu- suming investigation in Linux operating system area that ally the disk input-output (I/O) performance is related usually is impossible because of strong time limitations with time which needs to mechanical parts of the disk to for development process. move to a location of the data storing. This time usually This paper describes a method that allows any applica- defines the time delays in the data extraction. Operating tion developer to find the optimal value for the Linux systems incorporate disk read-ahead cache to minimize OS parameter: the optimal maximal read-ahead win- the time delays. Typically, the data from the disk are dow size. This parameter can be tuned by optimal buffered in a memory with a relatively fast access time. value in easy way that allows improving application per- If requested data is already reside in the cache mem- formance in short time without getting any knowledge ory, the data can be transferred directly from the cache about Linux kernel internals and spending a lot of time memory to the requester. In result the performance is in- for experimental search for the best system parameters. creased because the access to data from the cache mem- ory is substantially faster than the access from the disk Our method provides the prediction of optimal maximal drive [1]. read-ahead window size for Linux OS by using the mon- itoring tool for Linux kernel. Scenario of our method Very often such cache can be sufficiently effective. But using is very simple that allows obtaining the optimal sometimes it can produce the low system performance. value for maximal read-ahead window size for the sin- This relates with the sensitivity of the read-ahead cache gle application run. Our experiments for Linux 2.6 show to cache hit statistics [2]. A read-ahead cache having that our method detects an optimal read-ahead window a low hit rate may perform more poorly than an un- size for various real embedded applications with ade- cached disk due to caching overhead and queuing de- quate accuracy and optimization effect can be about a lays, among others. This problem is especially impor- few and even a few dozen percents in comparison to de- tant to be solved for embedded systems, because they fault case. The maximal observed optimization effect usually have less memory and slow CPUs than servers for accelerating the embedded application start-up time and workstations. was 59% in comparison to default case. Performance of read-ahead subsystem can be controlled Taking into account these facts the method proposed in by its main parameter - maximal read-ahead window • 83 • 84 • Prediction of Optimal Readahead Parameter in Linux by Using Monitoring Tool size: the maximum amount of data which can be read- tions in Linux kernel that contains general information ahead from block device. The performance of each ap- of system characterization. The current SWAP revision plication that is running under management OS depends can monitor both kernel and application levels of the on the performance of read-ahead cache. Thus, using Linux system. It provides evaluation of a set of impor- optimal maximal read-ahead window size value for the tant system characteristics for main Linux subsystems current application can improve performance of this ap- (such as Memory Management, Process Management, plication significantly. Typically, the finding the opti- File System and Network). Additional, current revision mal maximal read ahead window size for target applica- of SWAP has some automatic performance analysis fea- tion consists of the following steps: (1) tune operating tures such as trace comparison, automatic bottleneck re- system by current maximal read-ahead window; (2) re- gion localization, etc. boot the system; (3) run the target application; (4) mea- We have integrated our method into SWAP framework sure the time of execution of target application. These because SWAP satisfies to all necessary requirements of steps should be repeated several times for various maxi- our method. mal read-ahead window sizes until the optimal value of read-ahead window size will be found. The main dis- 2.1 General Idea advantage of such method is too much time that should be spent for finding the optimal value of maximal read- We suggest that optimal solution can be obtained by ahead window size. Thus, finding the optimal value of minimization of the following two characteristics: the maximal read-ahead window size during single applica- number of requests to the block device and the amount tion run could significantly improve the performance of of pages that were forced to read by target application, target application and save a lot of machine and human but were not used. resources. The big value of maximal read-ahead window size pro- 2 Method Overview vides minimization of the first characteristic – number of requests to the block device. However, in common The suggested technique consists of the following steps: situation the big value of maximal read-ahead window (1) user should collect data from the application and size provides reading a lot of pages from block device OS during application execution by monitoring tool for that are not used by application. In the other words the Linux kernel one time; (2) monitoring tool analyzes col- big value of maximal read-ahead window size makes OS lected data and evaluates optimal maximal read-ahead performs a lot of unnecessary job that is very time con- window size automatically; (3) user can access evalu- suming. It is obvious that application performance de- ated optimal read-ahead window size value via moni- grades because of such OS behavior. toring tool user interface. Thus, in comparison to man- The small value of maximal read-ahead window size ual method of finding optimal read-ahead window size provides minimization of the second characteristic – the and other existing methods (see [11], [12], [13] for de- amount of pages that were forced to read by target ap- tails), the suggested method has the following advan- plication, but were not used. However, in this case op- tages: (1) determines optimal maximal read-ahead win- timization effect of read-ahead cache is decreased be- dow size value during single run of application that is cause of a lot of application requests for memory pages to be optimized; (2) uses existing read-ahead subsystem invoke the requests to the block device instead of re- without any changes. quests to the read-ahead cache. This method is designed to be used as a module of a Thus, to reach the optimal OS behavior for current ap- monitoring tool such as SWAP - System-Wide Analyzer plication we need to obtain such maximal read-ahead of Performance developed by Samsung Research Cen- window size value that provides minimization of both ter (SRC) in Moscow. The initial version of SWAP characteristics simultaneously. was developed in 2006 and uses functional interfaces of Kprobe for providing dynamic instrumentation of Linux 2.2 Collected Data kernel for ARM and MIPS architecture. Next revision of SWAP tool was developed in SRC in 2007. This re- The first step of our method requires collecting the im- vision allowed collecting traces from predefined func- portant information about application behavior during 2010 Linux Symposium • 85 execution for future analyzing and evaluating the result. Application For these purposes, it is necessary to monitor the ac- cesses to the memory that has been performed by appli- Memory cation. SWAP has ability for tracking memory accesses 1 2 3 4 3 1 2 3 4 4 1 1 and organizing them in trace that allows estimating the Read−ahead window Read−ahead window following aspects: 1) the total number of accessed mem- ory pages, loaded from block device; 2) the addresses of 1 Pages which were not used by application accessed memory pages and their source (loaded from 2 Pages which were accessed by application and were block device or not); 3) the order of accesses. read directly from block device, without read−ahead 3 Pages which were accessed by application and were Notice, that our method requires the single application read from block device via read−ahead cache run only for gathering the monitoring information for 4 Pages which were read from block device into read−ahead evaluation of the optimal values of maximal read-ahead cache and were not used by application window size. Figure 1: Read-ahead emulation procedure 2.3 Analysis of Collected Data F = Rrn(Ma;Rws) (1) According to the basic idea, two following values should be minimized simultaneously: where Rrn is the number of requests to the block device, Ma is number of memory accesses that requires map- ping pages from block device and Rws is the maximal • F - number of requests to the block device; read-ahead window size.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages10 Page
-
File Size-