Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Your question and its title are inconsistent. Please clarify. –  John Gardeniers Jan 9 '11 at 22:26

6 Answers 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.

share|improve this answer

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.

share|improve this answer

My personal preference is "wget http://cdimage.debian.org/debian-cd/5.0.7/amd64/iso-cd/debian-507-amd64-CD-1.iso". Watch it saturate your connection!

share|improve this answer
    
mirrors.kernel.org has usually fast mirrors automatically relocated to the closest server to you... –  Hubert Kario Jan 9 '11 at 23:11
    
I find that those mirrors are actually quite slow in many cases. –  Publiccert Jan 9 '11 at 23:21

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

share|improve this answer
    
+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 9 '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 9 '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 9 '11 at 22:38
    
Yes, I meant to change that. I'll do it now. –  Dennis Williamson Jan 10 '11 at 0:32

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).

share|improve this answer

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...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.