How to get size of HTTP request and response including protocol overhead

httpnetwork-trafficrequesttraffic-management

I am working on an IoT-related research project with several devices. However, my project partner responsible for the infrastructure restricted the traffic for each device to a maximum of 500 MB per month.

To meet this restriction, I tried to estimate the request and response sizes with a very basic calculation. Some overhead estimations can be found in this answer on Stackoverflow. Prior to any overhead estimations, the answer states:

You have zero knowledge about the layers below HTTP. You can't even
assume the HTTP request will be delivered over TCP/IP. Even if it is,
you have zero knowledge about the overhead added by the network layer.
Or what the reliability of the route will be and what overhead will be
due to dropped/resent packets.

For some robust numbers, I thought about doing some measurements in a development setup since I am both working on the remote device and the server.

Are there any ways to measure the complete response and request sizes including both payload and any protocol overheads? How to determine the complete data throughput on the network infrastructure?

Best Answer

For Linux, and other unix(like) OSses you may use iftop utility. For example: Monitoring my router web interface: sudo iftop -f 'port 80 and host 172.19.76.1' -iwlan0

  • -f -- filter: port 80 -- monitor port 80 of the target host and host 172.19.76.1 -- hostname or address of the target host.
  • -iwlan0 -- [i]nterface wlan0

iftop screenshot

Related Topic