Bm + net/http sanity check

Hey all,

I’m using this in a quick-n-dirty script:

Benchmark.bm { |bm|

  [root1, root2].each_with_index { |host,i|

    bm.report("HTTP Host ##{i}: #{host}") {

  Net::HTTP.get host, "/#{stem}"

    }

  }

  [root1, root2].each_with_index { |host,i|

        r = `ping #{host}`[/Average = (.*)ms/]

        puts "Ping Host ##{i+1}: #{r}"

  }

}

To benchmark response times for two different websites.

Is there anything I’m incorrectly assuming about the Net::HTTP stuff, or
does this sound like a reasonable comparison?

Only reason I’m asking: ping delta is about 100 ms, but the Net::HTTP
delta
is about 700 ms. This does not jive with what I’m expecting, at all.

sd

Only reason I’m asking: ping delta is about 100 ms, but the Net::HTTP delta
is about 700 ms. This does not jive with what I’m expecting, at all.

Maybe consider the relative delta. The GET request should take quite a
bit longer than an ICMP echo, even if you don’t take the fact that one
is running in a benchmark framework of a scripting language and the
other is probably an OS executable.

These are different sites at different locations you’re benchmarking,
correct? Maybe different technologies were used, one is serving static
pages, the other has really screwy dynamic pages with an Access
backend…

Also, doesn’t .get actually download the content? Maybe the one page
is way bigger than the other?

-tim

Quoting [email protected], on Thu, May 18, 2006 at 07:58:28AM
+0900:

Only reason I’m asking: ping delta is about 100 ms, but the Net::HTTP delta
is about 700 ms. This does not jive with what I’m expecting, at all.

Why not? Sounds ok, setting up, using, and closing down a tcp line
should take at least 3 roundtrips, I think, so you’d need at least 300,
and if the data transfer takes a bit of time, bit of tcp stack overhead,
bit of software doing stuff… sounds like 700 ms.

running tcpdump might tell you exactly whats going on, with pretty
accurate timestamps.

Cheers,
Sam