fs benchmark
============

Introduction
============

The tool can be run on any machine that has python and some filesystem.
It goes through a series of filesystem operations, creating, rewriting,
reading, and deleting. It will wait for user input at each step, so you
can examine the filesystem. Currently this script is designed to focus on
stressing BTRFS, but can be used on any OS.

Configuration
=============

There are many configuration parameters to create files:
   - a number of files (default: 100000 files)
   - auto mode for determining file count
   - a max filesize    (default: 1024 bytes)
   - threshold percentage of how full to make the disk (default: 85%)
   - autocount flag will calculate the number of files required to fill the filesystem to the threshold
   - the read tests are disabled by default


These parameters need to be set based on the filesystem and disk size. There is a built in threshold mechanism
to limit the file creation so as to not fill the filesystem.

Usage
=====
usage: fs_benchmark.py [-h] [-a] [-c FILECOUNT] [-s FILESIZE] [-t THRESHOLD]
                       [--readtest]

Stress Test filesystem.

optional arguments:
  -h, --help            show this help message and exit
  -a, --autocount       Automatically calculate file count. default: False
  -c FILECOUNT, --count FILECOUNT
                        Number of files to create. default: 100000
  -s FILESIZE, --size FILESIZE
                        Maximum file size. default: 1024
  -t THRESHOLD, --threshold THRESHOLD
                        Maximum disk usage. default: 85 percent
  --readtest            Perform read tests. default: False

Running tests
=============

The benchmark will try to determine how a file system performs under the stress of handling
thousands of small files. The file size will vary between 50-100% the specified file size.
For example:

    create 300000 files (756B to 1536B) with data from /dev/urandom
    rewrite 30000 random files and change the size
    read 30000 sequential files
    read 30000 random files
    delete all files

It will sync and drop cache after every step.

Results for each operation displayed (average time in seconds, lower = better):


Examples
--------
Automatically calculate how many 1MB files will fill the disk to 85%, and create them:
  ./fs_benchmark.py -s 1048576 -a

Create 100000 1MB files:
  ./fs_benchmark.py -s 1048576 -c 100000

