Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test the speed for Socket?

I write a program which can forward ip packets between 2 servers, so how to test the speed of the program ? thanks!

like image 652
why Avatar asked Dec 23 '10 03:12

why


People also ask

How do I test my access point speed?

Click on Control Panel then go to Network and Internet > Network and Sharing Center > Change adapter settings. Double-click on the Wi-Fi connection from the list (it should be obvious which one it is) and in the window which opens you'll see a field called Speed.


2 Answers

There are a number of communication metrics that may be of interest to your potential users.

Latency is the amount of time to send a message, usually quoted in microseconds for co-located devices and in milliseconds for all other scenarios. It is usually quoted as the "zero-byte latency", meaning the time required to transmitted the meta-data of a message. Lower is better.

Bandwidth is measured in bits per second. It is often quoted as "peak bandwidth" and can be obtained by sending a massive amount of data over the line. Higher is better.

CPU utilization is the percent of CPU time required to transmit a message. Network protocols that can offload a message's transmission have low utilization, which means that the communication can "overlap" some other computation in the user's application, which has the effect of hiding latency. Lower is better.

All of these are measured simply by a variation of the ping test, usually called the "ping-pong":

Node 1:
    for n = 1 to MAXSIZE, step via n*=2
    send message of size n bytes
    receive a response of size n bytes

Node 2:
    for n = 1 to MAXSIZE, step via n*=2
    receive a message of size n bytes
    send response of size n bytes

There's also a "ping-ping" test, in which both nodes write to each other at the same time. This requires non-blocking communication to set-up.

Just output n and the time required for each iteration. The first time is the zero-byte latency. The largest sustainable n/time is the bandwidth (convert to bits per second to be industry standard). You can also measure the CPU utilization required to run the larger iterations, but that's a tricky topic for a whole different question.

like image 200
chrisaycock Avatar answered Sep 29 '22 19:09

chrisaycock


Take a look at iperf. You can find it at http://sourceforge.net/projects/iperf/ If you google around you will find tutorials for it. You can look at the source and might get some good ideas of how he does it. I use it for routine testing and it is quite robust

like image 31
J Henzel Avatar answered Sep 29 '22 18:09

J Henzel