Small script to execute a apache benchmark ab
from one host to other.
The scripts are designed for benchmark tsuru routers, and compare between hipache+nginx vs. vulcand.
It will gather metrics of request time and CPU in the target so they can be later plot using gnuplot.
You must install:
dstat
in the target host to get CPU metrics:ssh -F ssh.config $TARGET_HOST sudo apt-get install dstat
ab
in the source host to execute the test:ssh -F ssh.config -l ubuntu $SOURCE_HOST sudo apt-get install apache2-utils
You need to increase the files open limit in both origin and target nodes:
cat <<'EOF' | sudo tee /etc/security/limits.d/files.conf
* soft nofile 40000
* hard nofile 40000
EOF
sudo reboot # Recommended, I got issues to get this working if not :-m
If you want to test the routers directly, they allow connections from the
source host. Usually they should listen 0.0.0.0
Specifically, on hipache you might need to change /etc/hipache.conf
to make it listen
0.0.0.0
in order to do non SSL tests.
We need to hit some application. For this test, as we use tsuru, we
deploy a small static app as target for this test, called mystatic
.
tsuru login [email protected]
mkdir -p /tmp/myapp
cd /tmp/myapp
# Add an empty index.html
touch index.html
# And a file of 100k
dd if=/dev/urandom of=bigfile count=100 bs=1k
# And deploy the app
tsuru app-create mystatic static -t admin
tsuru app-deploy . -a mystatic
tsuru app-info -a mystatic
We scale this app to 6-8 units (containers) so we are sure that the backend is not the bottleneck.
tsuru unit-add 6 -a mystatic
This script expects a file called ssh.config
with the SSH configuration like
bastion hosts, ssh options, etc.
In our case, copy or link the file from tsuru-ansible
: ln -s ~/gds/tsuru-ansible/ssh.config .
The script is setup using environment variables, were the mandatory ones are:
DEPLOY_ENV
: your environmentTARGET_HOST
: one or the routersSOURCE_HOST
: for instance galdalf host
Check all the environment variables in generate_perf_test.sh
for all posible options.
A very minimal run:
DEPLOY_ENV=hector270715 \
TARGET_HOST=10.129.0.72 \
SOURCE_HOST=10.129.0.10 \
./execute_perf_test.sh
In test-plan.sh
there are some plans as example.
The script generate-md.sh
will generate graphs from results directories.