DragonFly BSD

HowToStressTest

Overview

Some people may have read about Peter Holms' Stress Test Suite on

commits@, and yes, Matt and I have found several bugs with it.

To get wider testing I thought I could write a little Stress-Test-Suite

guide. :)

Get the source

First of all, get the source, it's available at:

http://holm.cc/stress/src/

or

http://people.freebsd.org/~pho/stress/src/

And this is the version I'm using in this guide:

SHA1 (stress2.tgz) = 844faff0b5372cdbcfbfbe66ac769df597c56599

Last modified: 23-May-2006 14:31/18:30

So let's fetch it:

# fetch http://www.holm.cc/stress/src/stress2.tgz

Untar it somewhere and apply this patch:

http://leaf.dragonflybsd.org/~cosmicdj/stress2dfly.patch.gz

SHA1 (stress2dfly.patch.gz) = f0fd1b4290d2bdcfc45862b4279687afac9d2210

# fetch http://leaf.dragonflybsd.org/~cosmicdj/stress2dfly.patch.gz

# cd stress2; zcat ../stress2dfly.patch.gz | patch -p1

But before you start compiling it you need to tell

stress2/lib/resources.c your swapsize, so start your editor and search

for "const int64_t sz = 524256;". Now you need to replace 524256 with

your swapsize.

How to do that:

# swapinfo -k

Device 1K-blocks Used Avail Capacity

/dev/ad0s1b 637704 156 637548 0%

# echo "637704 / 4" | bc # take the 1K-blocks and devide them by 4

159426

Replace the (sz =) 524256 in lib/resources.c with this number!

You can compile the suite now:

# cd ../stress2

# make

One last thing before you can start stressing your machine, edit

default.cfg and change BLASTHOST to an IP with a machine running inetd

with UDP discard enabled. If you don't have such a machine you can set

it to 127.0.0.1 or your local NIC IP and use DragonFly's inetd with

discard dgram udp wait root internal

enabled (uncommented) in /etc/inetd.conf

So what's next?

Set up your environment, reboot

First some considerations. You want to stress test your machine?

Your machine could panic and fsck takes quite some time... and

uploading 1+GB crashdump isn't fun, either. So we'll do a reboot!

At the Beasty-bootmenu, select

6. Escape to loader prompt

and at the

ok

prompt we'll first limit the memory DragonFly BSD sees (and thus the

crashdump size) to 256MB

ok set hw.physmem="256M"

ok

and then we'll boot into single-user mode.

ok boot -s

Set up your environment, Post-reboot

The first thing we'll do is:

$ fsck -p

And then we'll mount some important dirs read-only!

$ mount -r /home # this is were the stress-test-suite is

$ mount -r /usr # you can leave this out but some cmds might come handy

$ mount /tmp # usualy MFS, if not: mount_mfs -s 262144 swap /tmp

$ mount /proc # shouldn't hurt...

Then we'll start some services:

$ /etc/rc.d/dumpon start # don't forget to set up a dumpdev in rc.conf

$ /etc/rc.d/swap1 start # a stress-test needs it

$ /etc/rc.d/netif start

If you don't have a "blasthost" with UDP discard enabled somewhere in your network,

just start a local inetd:

$ inetd -R 0 -p /tmp/inetd.pid # -R 0 disable rate limiting,

    # needed for the udp stress-test

How to run the stress-test

Quoting stress2/README: "Do not run the tests as root."

So let's switch to an ordinary user:

$ su -m ordinary_user

# cd /home/ordinary_user/stress2

# setenv INCARNATIONS 10

# ./run.sh

If you want some verbosity:

# setenv VERBOSE 4

# ./run.sh

And if you want to run all tests:

# ./run.sh all.cfg

And that's it. If the stress test triggers a panic,

your filesystems are safe because everything is mounted read-only.

Hints

If you got a panic, you need to boot with the same

hw.physmem settings, otherwise savecore will not find your crashdump!

Thanks

Thanks to Peter Holm (http://www.holm.cc) for his stress test.

Thanks to Matt Dillon and everyone else involved for DragonFly BSD.