0

What are the techniques to test the connection speed of a server (in my case, virtual Ubuntu server @ Slicehost)? Bonus points for one liner bash command.

Olivier Lalonde
  • 713
  • 3
  • 13
  • 20
  • What exactly are we testing? Are we testing website requests per second or what. Are we testing a single connection or multiple connections simultanious? Just saw it was asked 7 years ago, ok nvm. – Cristian Matthias Ambæk May 11 '18 at 18:20

5 Answers5

6

One of the better command line tools for checking bandwidth available is iperf. However you need another box on an known fast connection to run the test against. I'm not aware of any public iperf servers.

Niall Donegan
  • 3,859
  • 19
  • 17
3

Run netserver on one computer and netperf -h other.server.com -l 30 on another; see the official Netperf site for more details, source, and a Windows binary (most *nix port/package systems have netperf in them). Note: the results will be limited by the slowest connection between the two and port 12865 must be open on the server side.

Chris S
  • 77,337
  • 11
  • 120
  • 212
3

Take a look at this question for a technique to use dd over netcat and make note of the discovery that disk I/O was the limiting factor over a local network with the particular hardware involved. Over the internet and with faster hardware, your mileage may vary. By using /dev/zero as the source and /dev/null as the destination, the disk I/O factor will be eliminated as noted in the comments.

target system:
nc -l -p 9000 | pv | dd of=/dev/null

source system:
dd if=/dev/zero | pv | nc 9000 -q 10

Dennis Williamson
  • 60,515
  • 14
  • 113
  • 148
  • +1 for the use of pv. You can also replace /dev/hda by /dev/null and /dev/random for network testing without beeing limited by disk i/o. – petrus Jan 09 '11 at 22:27
  • Uh, excuse me, `dd of=/dev/hda`? Won't that overwrite the contents of first disk? The thread you linked to is about cloning a machine over the network... OP beware :) – linkedlinked Jan 09 '11 at 22:29
  • /dev/zero would be a good source for this - /dev/hda will be limited by disk I/O - and you'd want to set the "of" to /dev/null - OTHERWISE YOU'LL GET DATA LOSS. – JamesHannah Jan 09 '11 at 22:38
  • Yes, I meant to change that. I'll do it now. – Dennis Williamson Jan 10 '11 at 00:32
0

This is my own one-linner to get the time of th emost basic HTTP 1/1 request on my servers. Change www.foo.com by the ServerName and 192.168.1.15by the HTTP server IP (use the IP, as with the real name you would have the DNS search time added).

time printf 'GET / HTTP/1.1\nHost:www.foo.com\n\n' |nc -w 10 -q 10 192.168.1.15 80 1>/dev/null

I usually do it on a very simple default Virtualhost with a static HTML page, to get the base response time (no cgi or php things, not even session, mod_rewrite or auth managment.

For the real time tracking I use Nagios plugins, apache status results (very usefull on bash one linners as well wityh q=auto), and sometime autobench (based on httperf).

regilero
  • 1,470
  • 1
  • 9
  • 14
0

I think the simplest is to use iftop.

On the server @ slicehost run

sudo iftop

Then start downloading a large file with wget in another SSH window.

From the iftop man page:

The main part of the display lists, for each pair of hosts, the rate at which data has been sent and received over the preceding 2, 10 and 40 second intervals. The direction of data flow is indicated by arrows, <= and =>. For instance,

   foo.example.com  =>  bar.example.com      1Kb  500b   100b
                    <=                       2Mb    2Mb    2Mb

etc...

hookenz
  • 14,132
  • 22
  • 86
  • 142