| 1 |
# |
| 2 |
# Copyright (C) 2003-2004 EMC Corporation |
| 3 |
# |
| 4 |
# fs_mark: Benchmark synchronous/async file creation |
| 5 |
# |
| 6 |
# Written by Ric Wheeler <[email protected]> |
| 7 |
# |
| 8 |
# This program is free software; you can redistribute it and/or modify |
| 9 |
# it under the terms of the GNU General Public License as published by |
| 10 |
# the Free Software Foundation; either version 2 of the License, or |
| 11 |
# (at your option) any later version. |
| 12 |
# |
| 13 |
# This program is distributed in the hope that it will be useful, |
| 14 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
# GNU General Public License for more details. |
| 17 |
# |
| 18 |
# You should have received a copy of the GNU General Public License |
| 19 |
# along with this program; if not, write to the Free Software |
| 20 |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 21 |
# |
| 22 |
|
| 23 |
FS_MARK |
| 24 |
============== |
| 25 |
|
| 26 |
The fs_mark program is meant to give a low level bashing to file |
| 27 |
systems. The write pattern that we concentrate on is heavily |
| 28 |
synchronous IO across mutiple directories, drives, etc. |
| 29 |
|
| 30 |
SAMPLE RUN |
| 31 |
|
| 32 |
A typical run of the program would look like this: |
| 33 |
|
| 34 |
[root@c001n01 tmp]# ./fs_mark -d /mnt/support1/test_bulk -s 10240 -n 1000 |
| 35 |
|
| 36 |
# ./fs_mark -d /mnt/support1/test_bulk -s 10240 -n 1000 |
| 37 |
# Version Version 3.1, 1 thread(s) starting at Mon Sep 26 18:44:33 2005 |
| 38 |
# Sync method: INBAND FSYNC: fsync() per file in write loop. |
| 39 |
# Directories: no subdirectories used |
| 40 |
# File names: 40 bytes long, (16 initial bytes of time stamp with 24 random bytes at end of name) |
| 41 |
# Files info: size 10240 bytes, written with an IO size of 16384 bytes per write |
| 42 |
|
| 43 |
# All system call times are reported in microseconds. |
| 44 |
|
| 45 |
FSUse% Count Size Files/sec |
| 46 |
3 1000 10240 44.6 |
| 47 |
|
| 48 |
Or like this (using the verbose output flag): |
| 49 |
|
| 50 |
[root@c001n01 tmp]# ./fs_mark -d /mnt/support1/test_bulk -s 10240 -n 1000 -v |
| 51 |
|
| 52 |
# ./fs_mark -d /mnt/support1/test_bulk -s 10240 -n 1000 -v |
| 53 |
# Version Version 3.1, 1 thread(s) starting at Mon Sep 26 18:44:59 2005 |
| 54 |
# Sync method: INBAND FSYNC: fsync() per file in write loop. |
| 55 |
# Directories: no subdirectories used |
| 56 |
# File names: 40 bytes long, (16 initial bytes of time stamp with 24 random bytes at end of name) |
| 57 |
# Files info: size 10240 bytes, written with an IO size of 16384 bytes per write |
| 58 |
|
| 59 |
# All system call times are reported in microseconds. |
| 60 |
|
| 61 |
FSUse% Count Size Files/sec CREAT (Min/Avg/Max) WRITE (Min/Avg/Max) FSYNC (Min/Avg/Max) SYNC (Min/Avg/Max) CLOSE (Min/Avg/Max) UNLINK (Min/Avg/Max) |
| 62 |
3 1000 10240 43.5 24 111 17113 23 48 2937 14281 22811 219942 0 0 0 1 2 21 34 50 1180 |
| 63 |
|
| 64 |
Note that the output shows: |
| 65 |
Full: How full the file system is on the first directory specified. |
| 66 |
Count: How many files have been written so far |
| 67 |
Size: Size of files written |
| 68 |
Files/sec: The rate that files are written to disk. |
| 69 |
Min/Avg/Max: time spent in the creat/write/fsync/close and unlink system calls. |
| 70 |
|
| 71 |
In this run, we are writing using 4 threads to the specified target directory. |
| 72 |
|
| 73 |
To measure the performance of a file system from empty all the way to |
| 74 |
100 used, add the "-F" flag. Note that this test can take days to run |
| 75 |
depending on the size of the disk. |
| 76 |
|
| 77 |
In addition to the output, fs_mark writes the output into a separate |
| 78 |
log file that is intended to be easy to parse for graphing. |
| 79 |
|
| 80 |
|
| 81 |
A sample gnuplot script is attached for reference. |
| 82 |
|
| 83 |
Command line arguments: |
| 84 |
|
| 85 |
Basic flags: -F, -L, -l, -v, -w |
| 86 |
|
| 87 |
"-F" loops the test until the entire file system is filled. Note that |
| 88 |
files are not deleted in this test (-k is set automatically). |
| 89 |
|
| 90 |
"-L count" loops the test "count" times. |
| 91 |
|
| 92 |
"-l logfile_name" sets the name of the logfile. |
| 93 |
|
| 94 |
"-v" adds logging for each system call to record the minimum, |
| 95 |
average and maximum time spent. |
| 96 |
|
| 97 |
"-w buff_size" controls the size of individual write system calls in |
| 98 |
bytes. |
| 99 |
|
| 100 |
Thread control: -t |
| 101 |
|
| 102 |
"-t number" sets the number of threads used by the program. The |
| 103 |
threads are evenly divided between the specified subdirectories. Note that |
| 104 |
the program always uses one thread for each directory specified on the |
| 105 |
command line. |
| 106 |
|
| 107 |
DIRECTORY ARGUMENTS: -d, -D, -N, -M |
| 108 |
|
| 109 |
The "-d" argument allows you to specify one or more directories to run |
| 110 |
the test against. One thread is created for each of these root directories. |
| 111 |
Note that "-d" can appear multiple times. |
| 112 |
|
| 113 |
The "-D num" flag allows you to specify how many subdirectories you |
| 114 |
want to use under each of the above root directories. Invoking |
| 115 |
fs_mark with "-D 256" would create 256 directories under specified |
| 116 |
directory. Only one thread is used to write to all of the subdirectories. |
| 117 |
|
| 118 |
The multiple directory scheme helps measure the performance impact of |
| 119 |
using one large directory or many smaller directories. |
| 120 |
|
| 121 |
There are several ways of laying out the files in the |
| 122 |
multi-subdirectory tests. |
| 123 |
|
| 124 |
The "-N num" policy chooses to allocate "num" files per |
| 125 |
subdirectory. The program uses a simple round robin policy when -N |
| 126 |
is specified. |
| 127 |
|
| 128 |
If -N is not set, the program lingers in each directory for 180 |
| 129 |
seconds before moving onto the next subdirectory. There is |
| 130 |
currently no parameter to set this linger time. |
| 131 |
|
| 132 |
The default behavior of "-D" is to use the timed based hash with a |
| 133 |
lingering of 3 minutes per subdirectory. |
| 134 |
|
| 135 |
File specific arguments: -k, -r, -p, -n, -s, -S |
| 136 |
|
| 137 |
"-k" tells the test retain all created files. |
| 138 |
|
| 139 |
"-n num" specifies the number of files to be tested. |
| 140 |
|
| 141 |
"-p num" sets the length in bytes of filenames in a directory. By default, the |
| 142 |
files have sequential (time based) names. |
| 143 |
|
| 144 |
"-r num" sets the number of random bytes at the end of the file name. |
| 145 |
To have purely random names, use "-p X -r X". |
| 146 |
|
| 147 |
"-s num" specifies the size(s) of the files to be tested. |
| 148 |
|
| 149 |
|
| 150 |
Sync Methods: |
| 151 |
"-S number" selects a sync method. |
| 152 |
|
| 153 |
"-S 0" issues no sync() or fsync() calls at all. This should always |
| 154 |
be the fastest (if least safe!) way to run the program. |
| 155 |
|
| 156 |
"-S 1" issues an fsync() system call in the main file writing loop |
| 157 |
before closing the file. This is a common way to insure data |
| 158 |
integrity. |
| 159 |
|
| 160 |
"-S 2" writes all of the files in a loop without any fsync() |
| 161 |
calls. After this main loop terminates, one single system sync() |
| 162 |
call is issued followed by one fsync() call on the first file |
| 163 |
created per specified directory. |
| 164 |
|
| 165 |
The reasoning here is that the system level sync flushed the data |
| 166 |
back to disk and that the fsync() per directory insures that at |
| 167 |
least one write barrier operation flushed the volatile disk cache |
| 168 |
(this is a file system implementation specific behavior). |
| 169 |
|
| 170 |
"-S 3" writes all of the files in a loop without any fsync() |
| 171 |
calls. After this main loop terminates, the code iterates |
| 172 |
over the files in reverse order and opens each file, fsync()'s each |
| 173 |
file and closes each file. |
| 174 |
|
| 175 |
The reasoning here is that the most recent file is most likely to do |
| 176 |
a full fsync and trigger a journal flush, leaving the rest of the |
| 177 |
loop to do little work. |
| 178 |
|
| 179 |
"-S 4" writes all of the files in a loop without any fsync() |
| 180 |
calls. After this main loop terminates, one system sync() call is |
| 181 |
issued to flush the cache. Out of paranoia, the code then iterates |
| 182 |
over the files in reverse order as above (opens each file, fsync()'s each |
| 183 |
file and closes each file). |
| 184 |
|
| 185 |
"-S 5" writes all of the files in a loop without any fsync() |
| 186 |
calls. After this main loop terminates, the code iterates |
| 187 |
over the files in order and opens each file, fsync()'s each |
| 188 |
file and closes each file. |
| 189 |
|
| 190 |
"-S 6" writes all of the files in a loop without any fsync() |
| 191 |
calls. After this main loop terminates, one system sync() call is |
| 192 |
issued to flush the cache. Out of paranoia, the code then iterates |
| 193 |
over the files in order as above (opens each file, fsync()'s each |
| 194 |
file and closes each file). |
| 195 |
|
| 196 |
|