Benchmarking Network Performance
The network is one of the key aspects to consider while deploying the applications in the container environment. To do performance comparison with bare metal, the VM, and the container, we have to consider different scenarios as follows:
-
Bare metal to bare metal
-
VM to VM
-
Docker container to a container with the default networking mode (bridge)
-
Docker container to a container with host net (
--net=host) -
Docker container running inside a VM with the external world
In any of the preceding cases, we can pick up two endpoints to do the benchmarking. We can use tools such as nuttcp (http://www.nuttcp.net) and netperf (https://github.com/HewlettPackard/netperf) to measure the network bandwidth and request/response, respectively.
Getting ready
Make sure both the endpoints can reach each other and that you have the necessary packages/software installed. On Ubuntu, you can install nuttcp and netperf with the following command:
$ sudo apt-get install -y nuttcp netperf
How to do it…
To measure the network bandwidth using nuttcp, perform the following steps:
- Start the nuttcp server on one endpoint:
$ nuttcp -S
- Measure the transmit throughput (client to server) from the client with the following command and refer the below screenshot:
$ nuttcp -t <SERVER_IP>

- Measure the receiver throughput on the client (server to client) with the following command and refer the below screenshot:
$ nuttcp -r <SERVER_IP>

- To run the request/response benchmark using netperf; perform the following steps:
- Start
netserveron one endpoint:
$ netserver
NOTE
netserver starts up automatically on install. If netserver is already running and you run this command, you might get an error like Unable to start netserver with IN(6)ADDR_ANY port 12865 and family AF_UNSPEC . That is fine, it just means it is already running. To confirm it is running, you can run use ps -ef | grep netserver .
-
Connect to the server from the other endpoint and run the request/response test, refer to the output in the following screenshots:
-
For TCP:
$ netperf -H 172.17.0.6 -t TCP_RR

- For UDP:
$ netperf -H 172.17.0.6 -t UDP_RR

How it works…
In both of the cases mentioned earlier, one endpoint becomes the client and sends the requests to the server on the other endpoint.
There’s more…
We can collect the benchmark results for different scenarios and compare them. netperf can also be used for throughput tests.
See also
Look at the network benchmark results published by IBM and VMware in the links referenced earlier in this chapter.