Traffic Generators: Difference between revisions

 
(One intermediate revision by the same user not shown)
Line 28:
 
for i in `seq 1 99999`; do echo "Status Code:"; curl -s -o /dev/null -w "%{http_code}" https://10.1.1.1; sleep 1; done
 
;Bash Script
<pre>
# get output, append HTTP status code in separate line, discard error message
OUT=$( curl -sfI --connect-timeout 1 http://10.52.200.32/ | grep "HTTP" )
 
# get exit code
RET=$?
 
if [[ $RET -ne 0 ]] ; then
echo "Time out: $RET"
else
echo "$OUT"
fi
</pre>
while true; do ./monitor.sh; sleep 1; done
 
= Apache Benchmark =
Line 135 ⟶ 151:
 
Preparation
# sudo apt install git and-y curl packagesgit
curl -O https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
$ sudo apt install -y curl git
tar xvf go1.8.linux-amd64.tar.gz
 
sudo chown -R root:root go
# download go (do not install from Debian)
sudo mv go /usr/local/
$ curl -O https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
 
# unzip archive
$ tar xvf go1.8.linux-amd64.tar.gz
 
# set owner and group (recursive)
$ sudo chown -R root:root go
 
# move all into target directory
$ sudo mv go /usr/local/
# install git and curl packages
$ sudo apt install -y curl git
# download go (do not install from Debian)
$ curl -O https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
# unzip archive
$ tar xvf go1.8.linux-amd64.tar.gz
# set owner and group (recursive)
$ sudo chown -R root:root go
# move all into target directory
$ sudo mv go /usr/local/
 
Configure go (for user)
mkdir ~/.go
# create hidden go directory
echo "GOPATH=$HOME/.go" >> ~/.bashrc
$ mkdir ~/.go
echo "export GOPATH" >> ~/.bashrc
echo "PATH=\$PATH:/usr/local/go/bin:\$GOPATH/bin" >> ~/.bashrc
 
source ~/.bashrc
# configure needed paths (inside .bashrc)
go version
$ echo "GOPATH=$HOME/.go" >> ~/.bashrc
$ echo "export GOPATH" >> ~/.bashrc
$ echo "PATH=\$PATH:/usr/local/go/bin:\$GOPATH/bin" >> ~/.bashrc
 
# reload
$ source ~/.bashrc
 
# check go version
$ go version
go version go1.8 linux/amd64
 
# create hidden go directory
$ mkdir ~/.go
# configure needed paths (inside .bashrc)
$ echo "GOPATH=$HOME/.go" >> ~/.bashrc
$ echo "export GOPATH" >> ~/.bashrc
$ echo "PATH=\$PATH:/usr/local/go/bin:\$GOPATH/bin" >> ~/.bashrc
# reload
$ source ~/.bashrc
# check go version
$ go version
go version go1.8 linux/amd64
 
Install bombardier
go get -u github.com/codesenberg/bombardier
# install packages from github
bombardier --help
$ go get -u github.com/codesenberg/bombardier
 
Usage:
# show bombardier help
*Run with 10 connections on 5 sec and show latency statistics.
$ bombardier --help
bombardier -d 5s -c 10 -l -k https://www.heise.de
 
# install packages from github
$ go get -u github.com/codesenberg/bombardier
*Test for 60 seconds at 250 Insecure connections per second :
# show bombardier help
bombardier -c250 -k -d 60s "https://10.70.28.12/tools/healthcheck?api-key=0145463c-df61-4ebe-bbf1-ed3f43t4f57"
$ bombardier --help
 
Usage/Examples
 
# run with 5 connections on 10 sec.
$ bombardier -c 5 -k https://www.heise.de
Statistics Avg Stdev Max
Reqs/sec 32.44 37.83 201
Latency 152.35ms 72.93ms 1.24s
HTTP codes:
1xx - 0, 2xx - 329, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 6.18MB/s
 
# run with 10 connections on 5 sec and show latency statistics.
$ bombardier -d 5s -c 10 -l -k https://www.heise.de
Statistics Avg Stdev Max
Reqs/sec 56.51 59.10 251
Latency 173.10ms 102.95ms 1.32s
Latency Distribution
50% 155.83ms
75% 164.06ms
90% 174.99ms
99% 542.91ms
HTTP codes:
1xx - 0, 2xx - 294, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 10.63MB/s
 
# run with 5 connections on 10 sec.
$ bombardier -c 5 -k https://www.heise.de
 
Statistics Avg Stdev Max
Reqs/sec 32.44 37.83 201
Latency 152.35ms 72.93ms 1.24s
HTTP codes:
1xx - 0, 2xx - 329, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 6.18MB/s
# run with 10 connections on 5 sec and show latency statistics.
$ bombardier -d 5s -c 10 -l -k https://www.heise.de
 
Statistics Avg Stdev Max
Reqs/sec 56.51 59.10 251
Latency 173.10ms 102.95ms 1.32s
Latency Distribution
50% 155.83ms
75% 164.06ms
90% 174.99ms
99% 542.91ms
HTTP codes:
1xx - 0, 2xx - 294, 3xx - 0, 4xx - 0, 5xx - 0
others - 0
Throughput: 10.63MB/s
 
 
<br />