filebench

下载

wget https://jaist.dl.sourceforge.net/project/filebench/1.5-alpha3/filebench-1.5-alpha3.tar.gz

tar -zxf filebench-1.5-alpha3.tar.gz -C /usr/local

apt-get install gcc

apt-get install flex bison

安装

cd /usr/local/filebench-1.5-alpha3

./configure

make

make install

安装完成后的界面:

测试

cd /usr/local/share/filebench/workloads

filebench -f webserver.f

Workload model language解析

以videoserver.f为例:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
set $dir=/tmp
set $eventrate=96
set $filesize=10g
set $nthreads=48
set $numactivevids=32
set $numpassivevids=194
set $reuseit=false
set $readiosize=256k
set $writeiosize=1m

set $passvidsname=passivevids
set $actvidsname=activevids

set $repintval=10

eventgen rate=$eventrate

define fileset name=$actvidsname,path=$dir,size=$filesize,entries=$numactivevids,dirwidth=4,prealloc,paralloc,reuse=$reuseit
define fileset name=$passvidsname,path=$dir,size=$filesize,entries=$numpassivevids,dirwidth=20,prealloc=50,paralloc,reuse=$reuseit

define process name=vidwriter,instances=1
{
thread name=vidwriter,memsize=10m,instances=1
{
flowop deletefile name=vidremover,filesetname=$passvidsname
flowop createfile name=wrtopen,filesetname=$passvidsname,fd=1
flowop writewholefile name=newvid,iosize=$writeiosize,fd=1,srcfd=1
flowop closefile name=wrtclose, fd=1
flowop delay name=replaceinterval, value=$repintval
}
}

define process name=vidreaders,instances=1
{
thread name=vidreaders,memsize=10m,instances=$nthreads
{
flowop read name=vidreader,filesetname=$actvidsname,iosize=$readiosize
flowop bwlimit name=serverlimit, target=vidreader
}
}

echo "Video Server Version 3.0 personality successfully loaded"

run

workload最后必须要有run。

define fileset定义数据集:prealloc代表在实际的filebench工作负载启动之前预先分配的文件的百分比;reuse若设置为true,则如果在文件系统中存在相对应的文件,则filebench将重新使用该文件。

在workload中,run默认时间为60s,如果希望达到指定IO操作数就结束filebench,则可以使用finishoncount,语法为:

flowop finishoncount name=<name>,value=<ops>

  • name = Mandatory. Name of the flowop.
  • value= Mandatory. The number of operations to finish on.

参考资料:

  1. github filebench
  2. Filebench的安装与使用
  3. Workload model language