How to install dbench
Clone dbench from its git repo
# git clone git://git.samba.org/sahlberg/dbench.git dbench
# cd dbench
# make install
And that should be it. You should now have dbench installed on your system.
Features and Functions
- Reading SMBTORTURE BENCH-NBENCH loadfiles and emulating this workload as posix calls to a local filesystem
- NFS style loadfiles which allows DBENCH to mimic the i/o pattern of a real application doing real i/o to a real server.
- iSCSI support and iSCSI style loadfiles.
DBENCH is a tool to generate I/O workloads to either a filesystem or to a networked CIFS or NFS server. It can even talk to an iSCSI target. DBENCH can be used to stress a filesystem or a server to see which workload it becomes saturated and can also be used for preditcion analysis to determine “How many concurrent clients/applications performing this workload can my server handle before response starts to lag?”
DBENCH provides a similar benchmarking and client emulation that is implemented in SMBTORTURE using the BENCH-NBENCH test for CIFS, but DBENCH can play these loadfiles onto a local filesystem instead of to a CIFS server. Using a different type of loadfiles DBENCH can also generate and measure latency for NFS.
At the heart of DBENCH is the concept of a “loadfile”. A loadfile is a sequence of operations to be performed once statement at a time. This could be operations such as “Open file XYZ”, “Read 5 bytes from offset ABC”, “Close the file”, etc etc.
By carefully crafting a loadfile it is possible to describe an I/O pattern that almost exactly matches what a particular application performs. While cumbersome to produce, such a loadfile it does allow you to describe exactly how/what an application performs and “replay” this sequence of operations any time you want.
Each line in the DBENCH loadfile contain a timestamp for the operation. This is used by DBENCH to try to keep the same rate of operations as the original application. This is very useful since this allows to perform accurate scalability predictions based on the exact application we are interested in. and not an artificial benchmark which may or may not be relevant to our particular applications workload pattern.
At https://dbench.samba.org/web/index.html you can find three loadfile template to use:
- pNFS-Loadfiles - used to stress the NFS server.
- SMB-Loadfiles - used to stress the SMB server.
- iSCSI-Loadfiles - used to stress the iSCSI server.
How to use dbench
The following command should be OK for most of the testing situations(run dbench for 10 hours):
# dbench -c /usr/share/dbench/client.txt -D ./ -t 36000 10
This command stress the local filesystem, if you want to stress a NFS/SMB/iSCSI server, please learn more about dbench.
# dbench -c /usr/share/dbench/client.txt -D ./ -t 10 100
It gives out four numbers like this (this is from a 100 client run on fedora22 host):
Throughput 36.0963 MB/sec 100 clients 100 procs max_latency=2152.252 ms
The first is the true throughput as seen by dbench, the larger the batter. The last is the I/O latency, the smaller the better.
One question some people may ask is whether the above represents a realistic load on a fileserver. It doesn’t. Nearly 90% of the read/write IO operations in netbench are writes whereas in a “normal” office load reads dominate. Also, the load is much higher than a normal office PC would put on a server. There aren’t many office PCs that write over a hundred megabytes of data to a server in a few minutes, unless maybe they are copying a CD.
That doesn’t mean the benchmark is useless, it just means you shouldn’t use this for purchasing decisions unless you really understand the results and how they relate to your environment.
The main parameters
- -c - Use this as the full path name of the client.txt file (the default is /usr/share/dbench/client.txt).
- -s - Use synchronous file IO on all file operations(O_SYNC).
- -t TIME - set the runtime of the benchmark in seconds (default 600).
- -D DIR - set the base directory to run the filesystem operations in.
- -S - Use synchronous IO for all directory operations (unlink, rmdir, mkdir and rename).
- -F - fsync on write
- -B BACKEND - dbench backend (fileio, sockio, nfs, scsi, iscsi, smb)