Cleanup
[ikiwiki.git] / docs / howtos / HowToStressTest.mdwn
1
2 [[!toc levels=3 ]]
3
4
5
6 ## Overview 
7
8 Some people may have read about Peter Holms' Stress Test Suite on
9
10 commits@, and yes, Matt and I have found several bugs with it.
11
12
13
14 To get wider testing I thought I could write a little Stress-Test-Suite
15
16 guide. :)
17
18
19
20 ## Get the source 
21
22 First of all, get the source, it's available at:
23
24
25
26 http://holm.cc/stress/src/
27
28 or
29
30 http://people.freebsd.org/~pho/stress/src/
31
32
33
34 And this is the version I'm using in this guide:
35
36
37
38 SHA1 (stress2.tgz) = 844faff0b5372cdbcfbfbe66ac769df597c56599
39
40
41
42 Last modified: 23-May-2006 14:31/18:30
43
44
45
46 So let's fetch it:
47
48
49
50     
51
52     # fetch http://www.holm.cc/stress/src/stress2.tgz
53
54
55
56
57
58 Untar it somewhere and apply this patch:
59
60
61
62 http://leaf.dragonflybsd.org/~cosmicdj/stress2dfly.patch.gz
63
64
65
66 SHA1 (stress2dfly.patch.gz) = f0fd1b4290d2bdcfc45862b4279687afac9d2210
67
68
69
70     
71
72     # fetch http://leaf.dragonflybsd.org/~cosmicdj/stress2dfly.patch.gz
73
74     # cd stress2; zcat ../stress2dfly.patch.gz | patch -p1
75
76
77
78
79
80 But before you start compiling it you need to tell
81
82 stress2/lib/resources.c your swapsize, so start your editor and search
83
84 for "const int64_t sz = 524256;". Now you need to replace 524256 with
85
86 your swapsize.
87
88
89
90 How to do that:
91
92
93
94     
95
96     # swapinfo -k
97
98     Device 1K-blocks Used Avail Capacity
99
100     /dev/ad0s1b 637704 156 637548 0%
101
102     # echo "637704 / 4" | bc # take the 1K-blocks and devide them by 4
103
104     159426
105
106
107
108
109
110 Replace the (sz =) 524256 in lib/resources.c with this number!
111
112
113
114 You can compile the suite now:
115
116
117
118     
119
120     # cd ../stress2
121
122     # make
123
124
125
126
127
128 One last thing before you can start stressing your machine, edit
129
130 default.cfg and change BLASTHOST to an IP with a machine running inetd
131
132 with UDP discard enabled. If you don't have such a machine you can set
133
134 it to 127.0.0.1 or your local NIC IP and use DragonFly's inetd with
135
136
137
138     
139
140     discard dgram udp wait root internal
141
142
143
144
145
146 enabled (uncommented) in /etc/inetd.conf
147
148
149
150 So what's next?
151
152
153
154 ## Set up your environment, reboot 
155
156
157
158 First some considerations. You want to stress test your machine?
159
160 Your machine could panic and fsck takes quite some time... and
161
162 uploading 1+GB crashdump isn't fun, either. So we'll do a reboot!
163
164
165
166 At the Beasty-bootmenu, select
167
168
169
170     
171
172     6. Escape to loader prompt
173
174
175
176
177
178 and at the
179
180
181
182     
183
184     ok
185
186
187
188
189
190 prompt we'll first limit the memory DragonFly BSD sees (and thus the
191
192 crashdump size) to 256MB
193
194
195
196     
197
198     ok set hw.physmem="256M"
199
200     ok
201
202
203
204
205
206 and then we'll boot into single-user mode.
207
208
209
210     
211
212     ok boot -s
213
214
215
216
217
218 ## Set up your environment, Post-reboot 
219
220
221
222 The first thing we'll do is:
223
224
225
226     
227
228     $ fsck -p
229
230
231
232
233
234 And then we'll mount some important dirs read-only!
235
236
237
238     
239
240     $ mount -r /home # this is were the stress-test-suite is
241
242     $ mount -r /usr # you can leave this out but some cmds might come handy
243
244     $ mount /tmp # usualy MFS, if not: mount_mfs -s 262144 swap /tmp
245
246     $ mount /proc # shouldn't hurt...
247
248
249
250
251
252 Then we'll start some services:
253
254
255
256     
257
258     $ /etc/rc.d/dumpon start # don't forget to set up a dumpdev in rc.conf
259
260     $ /etc/rc.d/swap1 start # a stress-test needs it
261
262     $ /etc/rc.d/netif start
263
264
265
266
267
268 If you don't have a "blasthost" with UDP discard enabled somewhere in your network,
269
270 just start a local inetd:
271
272
273
274     
275
276     $ inetd -R 0 -p /tmp/inetd.pid # -R 0 disable rate limiting,
277
278         # needed for the udp stress-test
279
280
281
282
283
284 ## How to run the stress-test 
285
286
287
288 Quoting stress2/README: "Do not run the tests as root."
289
290
291
292 So let's switch to an ordinary user:
293
294
295
296     
297
298     $ su -m ordinary_user
299
300     # cd /home/ordinary_user/stress2
301
302     # setenv INCARNATIONS 10
303
304     # ./run.sh
305
306
307
308
309
310 If you want some verbosity:
311
312
313
314     
315
316     # setenv VERBOSE 4
317
318     # ./run.sh
319
320
321
322
323
324 And if you want to run all tests:
325
326
327
328     
329
330     # ./run.sh all.cfg
331
332
333
334
335
336 And that's it. If the stress test triggers a panic,
337
338 your filesystems are safe because everything is mounted read-only.
339
340
341
342 ## Hints 
343
344
345
346 If you got a panic, you need to boot with the same
347
348 hw.physmem settings, otherwise savecore will not find your crashdump!
349
350
351
352 ## Thanks 
353
354 Thanks to Peter Holm (http://www.holm.cc) for his stress test.
355
356 Thanks to Matt Dillon and everyone else involved for DragonFly BSD.
357