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.
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.
Take a look at this question for a technique to use
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.
nc -l -p 9000 | pv | dd of=/dev/null
dd if=/dev/zero | pv | nc 9000 -q 10
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).
I think the simplest is to use iftop.
On the server @ slicehost run
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