A distributed HTTP-based and REST-like ping-pong system for test and benchmarking purposes.
The intended usage of this tool suite (check it out on github) is to run two hosts which are queried (benchmarked) by a third host (the siege). Host 1 runs a ping service querying a pong service (on host 2) for the answer. Ping and pong build a very simple distributed system.
<img src=”/img/posts/pingpong-experiment.png” width=90%>
From a benchmark host (this is called the siege host) a benchmark (e.g. apachebench) is run againt host 1. Ping host 1 has to interact with pong host 2 to answer the request. The interaction between both hosts is very simple. Whenever host 1 (ping) is asked to deliver a document for ‘/ping/
So the following answers would be generated for following requests by host 2:
- GET /pong/4 returns “pong”
- GET /pong/5 returns “poong”
- GET /pong/6 returns “pooong”
- and so on
So we can vary the message size (and therefore the network load) between ping (host 1) and pong (host 2).
This setting shall be used to analyse the impact of infrastructures where ping and pong services are running on. The deployment above stays the same for every experiment. Just the underlying infrastructure of ping and pong changes. Therefore variations of benchmark results can be assigned to changing infrastructures.
Set up a benchmark experiment
To do a benchmark you have to set up a siege, a ping and a pong host. We assume these are Linux hosts with git, apt-get, wget and curl installed. Install this package on all of this three hosts by running following commands.
git clone https://github.com/nkratzke/pingpong.git cd pingpong sudo sh ./install.sh
This will install dart runtime and development environment, apachebench, docker as well as the docker overlay network weave.
It is possible to run the ping and pong service as a docker container. Therefore you have to build a pingpong image on your ping and pong hosts, like that:
docker build -t pingpong github.com/nkratzke/pingpong
Please be aware, that the dockerized ping-pong system will not show the same performance like a “naked” run ping-pong system.
On the pong host: Set up the pong service
First step is to start the pong service on the pong host. This will start the pong service on the host on port 8080.
pong:$ sudo dart bin/pong.dart --port=8080
It is although possible to run the pong server as docker container (you will have performance impacts of about 10% to 20%):
pong:$ docker build -t pingpong github.com/nkratzke/pingpong pong:$ docker run -d -p 8080:8080 pingpong --asPong --port=8080
You want to check wether the pong service is working correctly by checking that
pong:$ curl http://localhost:8080/pong/5
answers with ‘poong’.
Please figure out the IP adress or DNS name the your pong host. We will refer to it as
On the ping host: Set up the ping service
Second step is to start the ping service on the ping host. This will start the ping service on the host on port 8080.
You will have to provide the ping service where it will find its pong service by providing
<pongip> and port number you have assigned to the pong service above.
ping:$ sudo dart bin/ping.dart --port=8080 --url=http://<pongip>:8080
It is although possible to run the ping server as docker container (you will have performance impacts of about 10% to 20%):
pong:$ docker build -t pingpong github.com/nkratzke/pingpong pong:$ docker run -d -p 8080:8080 pingpong --asPing --port=8080 --url=http://<pongip>:8080
You want to check wether the ping service is started and able to communicate with the pong service by checking that
ping:$ curl http://localhost:8080/ping/5
answers with ‘poong’.
Please figure out the IP adress or DNS name the your ping host. We will refer to it as
On the siege host: set up apachebench
Third step you should run the benchmark to figure out the answer performance of your ping-pong system. On your siege host you will find a
run.sh script to start your benchmark. You should replace
http://<pingip>:8080/ping to provide the script the correct ping service uri.
# Run the experiment against # You have to specify your ping host here! URL=http://my.host.com/ping
run.sh script provides more parameters to vary your experiments. You can change
- the amount of concurrent messages,
- the message sizes,
- and how often each benchmark run per message size should be executed.
All benchmark results are written into a file
apachebench.log. This log file can be processed by
bin/analyze.dart to generate a csv file which is better suited to be imported into databases or statistical tools like R.
The following line converts experiment data (apachebench log format), tag it with a name (here ‘Reference’) and convert it into a csv file. You can use tags to distinguish different experiments for analysis.
dart bin/analze.dart --tag=Reference apachebench.log > reference.csv