Network bandwidth between client and server

I was observing degradation in performance between my client and server on cloud deployment. I was researching if network latency was the issue and how to measure network bandwidth between client and server.

I started by looking at existing tools that would help my investigation. The first tool that i got interested based on my reading of blogs etc was Iperf3

From my experience so far, its very straight forward and easy to use. Its written in the C.

  1. Download the source code.

wget http://downloads.es.net/pub/iperf/iperf-3.1.6.tar.gz

tar -xvf iperf-3.1.6.tar.gz

cd iperf-3.1.6

  1. Next install the c compiler for building the source code.

My environment was AWS, so it easy to install development tools which has c compiler included (and more)

sudo yum groupinstall “Development Tools”

  1. Compile, build the iperf from code base.

sudo -s (I got some permission issue when it tried to install with ec2-user)

./configure; make; make install

(The build will fail on AIX because of this bug – https://github.com/esnet/iperf/issues/312)

  1. Start iperf on the server using the server mode option

./src/iperf3 -s

  1. Start iperf on the client using the client mode option

./src/iperf3 -x.x.x.x -t 10000

Larger image content at https://blogshri.files.wordpress.com/2017/08/iperf.jpg?w=1400

 

iperf

The iperf3 documentation has the details of all the option and possibilities.

Different network exception and their causes

In client server communication, typically one will get subclass of IOException if there is connection issue between the client and server.  Based on the exact exception one can determine the possible causes.

Java application gets  java.net.UnknownHostException: spatel because of following reasons,

  1. Cannot perform DNS lookup because of network issue
  2. Some of issue with DNS server itself
  3. Host’s IP address cannot be determined by DNS.

(The server url in this case was https://spatel:443/testapp)

Java application gets  java.net.NoRouteToHostException: No route to host: connect because of following reasons

  1. When client is not able to reach the server because either server or intermediate router is down
  2. Some sort of network issue.

Java application gets  java.net.ConnectException: Connection refused: connect because of following reasons

  1. When client is able to ping server but the said service is not running on the specified port.
  2. May be server is down or under maintenance.

Java application gets java.net.SocketException: Connection reset because of following reasons

  1. When server terminates the connection abruptly instead of sending the complete response and then properly terminating the connection.
  2. Server goes down while processing the request.

Java application gets java.net.SocketTimeoutException: Read timed out because of following reasons

  1. Client has specified read timeout or socket timeout on connection and server does not respond before this time out occurs.
  2. This may indicate the socket\read timeout on client is short, so the server is not responding as per agreed SLA.