DEV Community

Gabriela Menocal for AWS Community Builders

Posted on • Edited on

How to measure the real time network traffic ‘from’ and ‘to’ your EC2 instances

``When working with traffic and time sensitive applications and workflows, it is always a good practice to measure the actual available bandwidth for your application.
This will help you in various ways, some of them are listed below:

  1. Define the baseline of the actual bandwidth available.
  2. Identify if there are any bottlenecks, and for troubleshooting purposes.
  3. The Data will help business decisions
  4. Increase and improve the service and customer satisfaction.

Fortunately Amazon offers an extensive list of official resources documentation, knowledge base articles, blogs, videos among others, while using with its cloud products and services.
I am not intend going into a detailed description about the use of each of them but rather sharing my experience how those tools have helped me, in conjunction with open sources tools, to solve problems and come up with better solutions for my customers by gathering information needed to take decisions.

One of the tools, which I believe most of the networks engineers have used at some point of their career, is IPERF. which as per their website described: “iPerf3 is a tool for active measurements of the maximum achievable bandwidth on IP networks”.

If you ever search for tutorials about this tool, you will notice that the majority (based on my own search experience) only describe how to use it for TCP traffic.

Wait! Before continuing, I am assuming that you have a basic knowledge of network concepts such as model OSI, particularly Transport Layer. But if this is not the case, I found these well explained articles that will help you understand a little bit more.

1.The OSI model explained and how to easily remember its 7 layers.

  1. What is the OSI Model?

Lets continue from where I left, in my previous experience using IPERF3 it was especially to verify that the available bandwidth is what I was told, for the simple reason the application was sensible to the bandwidth availability.

For this blog I will measure both TCP and UDP Traffic.

The Network topology I used is shown below:

Image description

For this tests, I used IPERF3 version.

  • Running the Iperf server's commands on the EC2 instance in AWS.
  • Running the Iperf client's command on my laptop.
  1. Server's side command (AWS): iperf -S

Image description

Image description

  1. Client's side command (Laptop):iperf -C 'Server IP'

Image description

Image description

So far, this is something you will normally find as an examples while looking in how to use Iperf, but something is not as common is measuring UDP traffic, the main difference is you need to add the tag: -u and -b (bandwidth) on the client side as is shown below:

  1. __UDP => __Client's side command (Laptop): iperf -C 'Server IP'-u -b 1M
  • where '1M' represents 1 Mbps

Image description

You can also add the tag '-p', in the below example I am sending two paralell connections to the server and the bandwith limit is applied separately to each stream.

Image description
`
Please review the official documentaion link, for further information IPERF3 Documentation

I hope this article help is useful for you!!

Top comments (0)