xref: /aosp_15_r20/external/stressapptest/README.md (revision 424fb153c814cbcb3e8904974796228774b3229a)
1*424fb153SAndroid Build Coastguard Worker# stressapptest
2*424fb153SAndroid Build Coastguard WorkerStressful Application Test (or stressapptest, its unix name) is a memory interface test.
3*424fb153SAndroid Build Coastguard WorkerIt tries to maximize randomized traffic to memory from processor and I/O, with the intent of creating a realistic high load situation in order to test the existing hardware devices in a computer. It has been used at Google for some time and now it is available under the apache 2.0 license.
4*424fb153SAndroid Build Coastguard Worker
5*424fb153SAndroid Build Coastguard Worker  (Exported from code.google.com/p/stressapptest)
6*424fb153SAndroid Build Coastguard Worker
7*424fb153SAndroid Build Coastguard WorkerDiscussion group: https://groups.google.com/d/forum/stressapptest-discuss
8*424fb153SAndroid Build Coastguard Worker
9*424fb153SAndroid Build Coastguard Worker
10*424fb153SAndroid Build Coastguard Worker## Usage
11*424fb153SAndroid Build Coastguard Worker
12*424fb153SAndroid Build Coastguard WorkerTo execute, a typical command would be:
13*424fb153SAndroid Build Coastguard Worker```
14*424fb153SAndroid Build Coastguard Worker./stressapptest -s 20 -M 256 -m 8 -W    # Test 256MB, running 8 "warm copy" threads. Exit after 20 seconds.
15*424fb153SAndroid Build Coastguard Worker./stressapptest --help                  # list the available arguments.
16*424fb153SAndroid Build Coastguard Worker```
17*424fb153SAndroid Build Coastguard WorkerCommon arguments
18*424fb153SAndroid Build Coastguard Worker* -M mbytes : megabytes of ram to test (auto-detect all memory available)
19*424fb153SAndroid Build Coastguard Worker* -s seconds : number of seconds to run (20)
20*424fb153SAndroid Build Coastguard Worker* -m threads : number of memory copy threads to run (auto-detect to number of CPUs)
21*424fb153SAndroid Build Coastguard Worker* -W : Use more CPU-stressful memory copy (false)
22*424fb153SAndroid Build Coastguard Worker* -n ipaddr : add a network thread connecting to system at 'ipaddr'. (none)
23*424fb153SAndroid Build Coastguard Worker* --listen : run a thread to listen for and respond to network threads. (0)
24*424fb153SAndroid Build Coastguard Worker* -f filename : add a disk thread with tempfile 'filename' (none)
25*424fb153SAndroid Build Coastguard Worker* -F : don't result check each transaction, use libc memcpy instead. (false)
26*424fb153SAndroid Build Coastguard Worker
27*424fb153SAndroid Build Coastguard WorkerError handling
28*424fb153SAndroid Build Coastguard Worker* -l logfile : log output to file 'logfile' (none)
29*424fb153SAndroid Build Coastguard Worker* -v level : verbosity (0-20) (default: 8)
30*424fb153SAndroid Build Coastguard Worker
31*424fb153SAndroid Build Coastguard Worker```
32*424fb153SAndroid Build Coastguard Worker./stressapptest -s 20 -M 256 -m 8 -C 8 -W # Allocate 256MB of memory and run 8 "warm copy" threads, and 8 cpu load threads. Exit after 20 seconds.
33*424fb153SAndroid Build Coastguard Worker./stressapptest -f /tmp/file1 -f /tmp/file2 # Run 2 file IO threads, and autodetect memory size and core count to select allocated memory and memory copy threads.
34*424fb153SAndroid Build Coastguard Worker```
35*424fb153SAndroid Build Coastguard Worker
36*424fb153SAndroid Build Coastguard Worker
37*424fb153SAndroid Build Coastguard Worker## Installation
38*424fb153SAndroid Build Coastguard Worker
39*424fb153SAndroid Build Coastguard Workerstressapptest is often available on linux and can be installed as a distro package:
40*424fb153SAndroid Build Coastguard Worker```
41*424fb153SAndroid Build Coastguard Workersudo apt-get install stressapptest
42*424fb153SAndroid Build Coastguard Workersudo emerge stressaptest
43*424fb153SAndroid Build Coastguard Workersudo yum install stressapptest
44*424fb153SAndroid Build Coastguard Workersudo zypper install stressapptest
45*424fb153SAndroid Build Coastguard Worker```
46*424fb153SAndroid Build Coastguard WorkerTo build from source, the build/installation package follows the GNU guidelines. So, to download the latest package:
47*424fb153SAndroid Build Coastguard Worker```
48*424fb153SAndroid Build Coastguard Workergit clone https://github.com/stressapptest/stressapptest.git
49*424fb153SAndroid Build Coastguard Workercd stressapptest
50*424fb153SAndroid Build Coastguard Worker./configure
51*424fb153SAndroid Build Coastguard Workermake
52*424fb153SAndroid Build Coastguard Workersudo make install
53*424fb153SAndroid Build Coastguard Worker```
54*424fb153SAndroid Build Coastguard WorkerAnd it should be installed. You can use the most common options on the configure script, it was generated by autoconf and automake, so they are accepted.
55*424fb153SAndroid Build Coastguard Worker
56*424fb153SAndroid Build Coastguard Worker
57*424fb153SAndroid Build Coastguard Worker## Objective
58*424fb153SAndroid Build Coastguard Worker
59*424fb153SAndroid Build Coastguard WorkerStressful Application Test (or stressapptest) tries to maximize randomized traffic to memory from processor and I/O, with the intent of creating a realistic high load situation.
60*424fb153SAndroid Build Coastguard Worker
61*424fb153SAndroid Build Coastguard Workerstressapptest may be used for various purposes:
62*424fb153SAndroid Build Coastguard Worker* Stress test: as described here.
63*424fb153SAndroid Build Coastguard Worker* Hardware qualification and debugging.
64*424fb153SAndroid Build Coastguard Worker* Memory interface test: see the Theory behind this.
65*424fb153SAndroid Build Coastguard Worker* Disk testing.
66*424fb153SAndroid Build Coastguard Worker
67*424fb153SAndroid Build Coastguard Worker
68*424fb153SAndroid Build Coastguard Worker**Background**
69*424fb153SAndroid Build Coastguard Worker
70*424fb153SAndroid Build Coastguard WorkerMany hardware issues reproduce infrequently, or only under corner cases. The theory being used here is that by maximizing bus and memory traffic, the number of transactions is increased, and therefore the probability of failing a transaction is increased.
71*424fb153SAndroid Build Coastguard Worker
72*424fb153SAndroid Build Coastguard Worker
73*424fb153SAndroid Build Coastguard Worker**Overview**
74*424fb153SAndroid Build Coastguard Worker
75*424fb153SAndroid Build Coastguard Workerstressapptest is a userspace test, primarily composed of threads doing memory copies and directIO disk read/write. It allocates a large block of memory (typically 85% of the total memory on the machine), and each thread will choose randomized blocks of memory to copy, or to write to disk. Typically there are two threads per processor, and two threads for each disk. Result checking is done as the test proceeds by CRCing the data as it is copied.
76*424fb153SAndroid Build Coastguard Worker
77*424fb153SAndroid Build Coastguard Worker
78*424fb153SAndroid Build Coastguard Worker**Detailed Design**
79*424fb153SAndroid Build Coastguard Worker
80*424fb153SAndroid Build Coastguard WorkerThe code is structured fairly simply:
81*424fb153SAndroid Build Coastguard Worker
82*424fb153SAndroid Build Coastguard WorkerA large amount of memory is allocated in a single block (default is 85% of physical memory size).
83*424fb153SAndroid Build Coastguard WorkerMemory is divided into chunks, each filled with a potentially stressful data pattern.
84*424fb153SAndroid Build Coastguard WorkerWorker threads are spawned, which draw pages from an "empty" queue and a "valid" queue, and copy the data from one block to the other.
85*424fb153SAndroid Build Coastguard WorkerSome threads memory copy the data.
86*424fb153SAndroid Build Coastguard WorkerSome threads invert the data in place.
87*424fb153SAndroid Build Coastguard WorkerSome threads write the data to disk, and read it to the new location.
88*424fb153SAndroid Build Coastguard WorkerAfter the specified time has elapsed, all "valid" pages have their data compared with the original fill pattern.
89*424fb153SAndroid Build Coastguard Worker
90*424fb153SAndroid Build Coastguard Worker
91*424fb153SAndroid Build Coastguard Worker**Caveats**
92*424fb153SAndroid Build Coastguard Worker
93*424fb153SAndroid Build Coastguard WorkerThis test works by stressing system interfaces. It is good at catching memory signal integrity or setup and hold problems, memory controller and bus interface issues, and disk controller issues. It is moderately good at catching bad memory cells and cache coherency issues. It is not good at catching bad processors, bad physical media on disks, or problems that require periods of inactivity to manifest themselves. It is not a thorough test of OS internals. The test may cause marginal systems to become bricks if disk or memory errors cause hard drive corruption, or if the physical components overheat.
94*424fb153SAndroid Build Coastguard Worker
95*424fb153SAndroid Build Coastguard Worker
96*424fb153SAndroid Build Coastguard Worker**Security Considerations**
97*424fb153SAndroid Build Coastguard Worker
98*424fb153SAndroid Build Coastguard WorkerSomeone running stressapptest on a live system could cause other applications to become extremely slow or unresponsive.
99*424fb153SAndroid Build Coastguard Worker
100*424fb153SAndroid Build Coastguard Worker
101*424fb153SAndroid Build Coastguard Worker**Logged information**
102*424fb153SAndroid Build Coastguard Worker
103*424fb153SAndroid Build Coastguard Workerstressapptest can output a logfile of miscompares detected during its execution. stressapptest cannot yet log reboot failures, or other failures not visible to user space.
104*424fb153SAndroid Build Coastguard Worker
105