title: How to measure network performance (how to benchmark network protocol)
body: <p>First, a bit of a background. There are many various comparisons of distributed version control systems (DVCS) which compare size of repository, or benchmark speed of operations. I haven't found any that would benchmark network performance of various DVCS, and various protocols used... beside measuring speed of operations (commands) involving network like 'clone', 'pull'/'fetch' or 'push'.</p>
  
  <p>I'd like to know then how would you make such comparison; how to measure network performance of an application, or how to benchmark network protocol. I envision here among others also measuring dependence of performance on both bandwidth of network and latency (ping time) of network; some protocols sacrifice latency in the form of more round-trip exchanges (negotiation) to send minimal required final "pack".</p>
  
  <p>I would prefer solutions involving only one computer, if possible. I'd like to see open source solutions, working on Linux. But I would also welcome more generic answers.</p>
  
  <p><strong>Preferred OS:</strong> Linux<br>
  <strong>Preferred languages:</strong> C, Perl, shell script</p>
  
  <hr>
  
  <p><strong><em>Possible measurements:</em></strong></p>
  
  <ul>
  <li>total number of bytes transferred from server to client and from client to server in one session; this can also be used to measure overhead of protocol <em>(bandwidth)</em></li>
  <li>number of round-trips (connections) in one transaction <em>(latency)</em></li>
  <li>dependency of speed of network operation (time it takes to clone/pull/push) from network bandwidth, and from network latency (ping time)</li>
  </ul>
  
  <p>How to make such measurements (such benchmarks)?</p>
  
  <hr>
  
  <p><strong>Added 02-06-2009:</strong><br>
  A simplest benchmark (measurement) would be a network version of <code>time</code> command, i.e. command which run would give me number of bytes transferred, and number of round trips / network connections during execution of a given command.</p>
  
  <hr>
  
  <p><strong>Added 09-06-2009:</strong><br>
  <em>Example</em> imaginary output for mentioned above solution of network version of <code>time</code> command could look like the following:</p>
  
  <pre><code>$ ntime git clone -q git://git.example.com/repo.git
  ...
  bytes sent: nnn (nn kiB), bytes received: nnn (nn kiB), avg: nn.nn KB/s
  nn reads, nn writes
  </code></pre>
  
  <p>Note that it is only an example output, detailing kind of information one might want to get.</p>
  
  <hr>
  
  <p><strong>Added 09-06-2009:</strong><br>
  It looks like some of what I want can be acheived using <strong>dummynet</strong>, tool (originally) for testing networking protocols...</p>