File tree 4 files changed +30
-69
lines changed
4 files changed +30
-69
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,6 @@ if [[ -t 1 ]] && (( $terminfo[colors] >= 8 )); then
9
9
colors
10
10
fi
11
11
12
- which vegeta > /dev/null || error " Missing vegeta, unable to run stress tests"
13
-
14
12
typeset -g VEGETA_OPTS VERBOSE DURATION
15
13
16
14
# Output directories
@@ -24,6 +22,8 @@ source $STRESS_DIR/../utils.sh
24
22
mkdir -p $TESTTMP $TESTROOT
25
23
: >> $CONF
26
24
25
+ which vegeta > /dev/null || error " Missing vegeta, unable to run stress tests"
26
+
27
27
function help() {
28
28
<< EOF
29
29
Usage: stress.sh [OPTIONS] [file]
48
48
49
49
function attack() {
50
50
echo " GET http://127.0.0.1:$PORT /" | \
51
- vegeta attack -name=$1 " ${=VEGETA_OPTS} " > $REPORT_DIR /$1 .bin
51
+ vegeta attack -name=${ @ [-1]} " ${=VEGETA_OPTS} " ${ @ [1,-2]} > $REPORT_DIR /${ @ [-1]} .bin
52
52
53
- (( VERBOSE )) && vegeta report $REPORT_DIR /$1 .bin
53
+ (( VERBOSE )) && vegeta report $REPORT_DIR /${ @ [-1]} .bin
54
54
55
55
return 0
56
56
}
87
87
: ${DURATION:= " 5s" }
88
88
: ${VERBOSE:= 0}
89
89
90
- VEGETA_OPTS=" -duration=$DURATION -http2=false -timeout=10s"
90
+ VEGETA_OPTS=" -duration=$DURATION -http2=false -timeout=10s -keepalive=false "
91
91
92
92
# Preserve TESTROOT across tests
93
93
root=$TESTROOT
@@ -109,5 +109,3 @@ for i in ${1:-$STRESS_DIR/stress_*.sh}; do
109
109
print " $fg_bold [magenta]${i: t} $fg_no_bold [white]"
110
110
source $i
111
111
done
112
-
113
- vegeta plot $REPORT_DIR /* .bin > $HTML_DIR /full.html
Original file line number Diff line number Diff line change @@ -12,14 +12,12 @@ HTTP_CACHE=0
12
12
HTML_CACHE=0
13
13
EOF
14
14
15
- stop_server
16
15
TESTROOT=$root
17
- start_server
18
- heartbeat
16
+ restart_server
19
17
20
18
# Default directory listing
21
19
describe " Default directory serving"
22
- attack defaults_dir
20
+ attack default_directory
23
21
24
22
# Cache
25
23
<< EOF > $CONF
@@ -33,8 +31,8 @@ HTML_CACHE=1
33
31
EOF
34
32
reload_conf
35
33
36
- describe " Directory listing with cache "
37
- attack cache_dir
34
+ describe " Directory serving with caching "
35
+ attack cache_directory
38
36
39
37
# Compress directory
40
38
<< EOF > $CONF
@@ -57,8 +55,8 @@ source $SRC_DIR/modules/compress.sh
57
55
EOF
58
56
reload_conf
59
57
60
- describe " Directory listing compression"
61
- attack compress_dir
58
+ describe " Directory serving with compression"
59
+ attack compress_directory
62
60
63
61
# Compress directory with cache
64
62
<< EOF > $CONF
@@ -81,7 +79,7 @@ source $SRC_DIR/modules/compress.sh
81
79
EOF
82
80
reload_conf
83
81
84
- describe " Directory listing compression+cache"
85
- attack compress_cache_dir
82
+ describe " Directory serving compression+cache"
83
+ attack compress+cache_directory
86
84
87
- vegeta plot $REPORT_DIR /* _dir .bin > $HTML_DIR /directory_listing.html
85
+ vegeta plot $REPORT_DIR /* _directory .bin > $HTML_DIR /directory_listing.html
Original file line number Diff line number Diff line change @@ -12,14 +12,11 @@ HTTP_CACHE=0
12
12
HTML_CACHE=0
13
13
EOF
14
14
15
- stop_server
16
15
TESTROOT=$root /test.html
17
- start_server
18
- heartbeat
16
+ restart_server
19
17
20
- # Default file listing
21
- describe " Default file serving"
22
- attack defaults_file
18
+ describe " Default file serving with HTTP keep-alive"
19
+ attack -keepalive=true default_keep-alive_file
23
20
24
21
# Disable keep-alive
25
22
<< EOF > $CONF
@@ -33,8 +30,8 @@ HTML_CACHE=0
33
30
EOF
34
31
reload_conf
35
32
36
- describe " Disabled keep-alive"
37
- attack no_keep -alive_file
33
+ describe " Default file serving without HTTP keep-alive"
34
+ attack default_no_keep -alive_file
38
35
39
36
# Single file compress
40
37
<< EOF > $CONF
80
77
reload_conf
81
78
82
79
describe " Single file compression+cache"
83
- attack compress_cache_file
80
+ attack compress+cache_file
84
81
85
82
# Finally
86
- vegeta plot $REPORT_DIR /* _file.bin > $HTML_DIR /file_listing .html
83
+ vegeta plot $REPORT_DIR /* _file.bin > $HTML_DIR /file_serving .html
Original file line number Diff line number Diff line change 2
2
# Stress test concurrent connections. Will be sourced by `test.sh` #
3
3
# ###################################################################
4
4
5
- VEGETA_OPTS+=" -rate=500/1s -keepalive=false"
6
-
7
- << EOF > $CONF
8
- MAX_CONN=1
9
- HTTP_KEEP_ALIVE=1
10
- HTTP_TIMEOUT=30
11
- HTTP_RECV_TIMEOUT=5
12
- HTTP_BODY_SIZE=16384
13
- HTTP_CACHE=0
14
- HTML_CACHE=0
15
- EOF
16
-
17
- stop_server
18
- TESTROOT=$root /test.html
19
- start_server
20
- heartbeat
21
-
22
-
23
- # Single connection
24
- describe " Multiple connections with MAX_CONN = 1"
25
- attack single_multiple
26
-
27
- vegeta plot $REPORT_DIR /single_multiple.bin > $HTML_DIR /single_multiple.html
28
-
29
5
<< EOF > $CONF
30
6
MAX_CONN=12
31
- HTTP_KEEP_ALIVE=1
7
+ HTTP_KEEP_ALIVE=0
32
8
HTTP_TIMEOUT=30
33
9
HTTP_RECV_TIMEOUT=5
34
10
HTTP_BODY_SIZE=16384
35
11
HTTP_CACHE=0
36
12
HTML_CACHE=0
37
13
EOF
38
14
39
- # Clean testing env
40
- stop_server
41
- start_server
42
- heartbeat
15
+ TESTROOT=$root /test.html
16
+ restart_server
43
17
44
18
# Default number connections
45
19
describe " Multiple connections with MAX_CONN = 12"
46
- attack default_multiple
47
-
48
- vegeta plot $REPORT_DIR /default_multiple.bin > $HTML_DIR /default_multiple.html
20
+ attack -rate=" 500/1s" default_max_conn
49
21
50
22
<< EOF > $CONF
51
- MAX_CONN=48
52
- HTTP_KEEP_ALIVE=1
23
+ MAX_CONN=30
24
+ HTTP_KEEP_ALIVE=0
53
25
HTTP_TIMEOUT=30
54
26
HTTP_RECV_TIMEOUT=5
55
27
HTTP_BODY_SIZE=16384
56
28
HTTP_CACHE=0
57
29
HTML_CACHE=0
58
30
EOF
59
31
60
- stop_server
61
- start_server
62
- heartbeat
32
+ restart_server
63
33
64
34
# Increased number connections
65
35
describe " Multiple connections with MAX_CONN = 30"
66
- attack max_multiple
67
-
68
- vegeta plot $REPORT_DIR /max_multiple.bin > $HTML_DIR /max_multiple.html
36
+ attack -rate=" 500/1s" 30_max_conn
69
37
70
38
# Finally
71
- vegeta plot $REPORT_DIR /* _multiple .bin > $HTML_DIR /multiple .html
39
+ vegeta plot $REPORT_DIR /* _conn .bin > $HTML_DIR /max_conn .html
You can’t perform that action at this time.
0 commit comments