Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to measure the network bandwidth used between client and server?

I have a client which GETs a JSON response from a server. I want to calculate how many requests/responses will consume my allotted transfer allowance from a web hosting company (e.g. 100GB per month).

How do I measure/calculate this?

I assume I only need to measure once because the msgs are of a consistent length and format.

I have control over client/server/network. All can be uniquely dedicated to the task. The client is an IOS App and the server is a PHP REST Web Service (on Windows). Both on my LAN.

I know nothing about this and so far have just got the size of the JSON using strlen(). Is that even heading in the right direction?

like image 487
Polly Avatar asked Aug 26 '12 16:08

Polly


2 Answers

I would recommend using Charles Proxy. It is an invaluable tool for debugging all kinds of information exchanged via HTTP. You may use it for tracing all HTTP/s communication from and to your iPhone/iPod/iPad as well as the simulator.

It does unfortunately not work too well with most Android devices as those do not really support configuring a system-wide HTTP proxy. For those cases and non HTTP-based communication, I would recommend using WireShark.

In some rare cases, for reasons that are still unclear to me, Charles rarely fails on iOS devices for HTTP-based connections - a typical case would be GoogleAnalytics. For those, again I would recommend WireShark.

like image 57
Till Avatar answered Sep 28 '22 17:09

Till


The length of JSON string gives you only the size of the payload field in the transferred network packets. This data field may be encapsulated within an HTTP packet and HTTP packet should be put into an IP packet before transmission. Each of these packets have header fields which contributes to total transmission length.

So, for a precise estimate you should first find the real length of the response packet by using Wireshark or an equivalent tool. If this is the only request type for your application you can divide your bandwidth to the response size of your server application to get maximum number of requests to reach the limit. However, this is usually not the case if you have a web application which has several web pages that are accessible from clients, since any access (browsing) will cause a data transfer from server to client.

like image 33
mostar Avatar answered Sep 28 '22 16:09

mostar