Forum: Ruby Net::HTTP performance difference: FreeBSD vs. Ubuntu ?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Ae1c93ceb4d3d79a1db8979382b1d59d?d=identicon&s=25 J. Wook (Guest)
on 2007-05-04 07:26
Strange ruby network performance drop examined on Ubuntu.

I made a simple HTTP testing code like below.

redirect_url = ""
success_url  = ""
invalid_url  = ""
error_url    = ""

start_time =
downloaded = 0

5.times do

    uri = URI.parse(redirect_url)
    r = Net::HTTP.get_response(uri)
    c += r.body.size
  rescue Exception => e
    puts e.class

  ... iterate for success_url, invalid_url, error_url


puts "Total: #{downloaded/1000} KB,  #{ - start_time} seconds"

Result was... very strange.

MacBook                 about 20 sec
FreeBSD6.1             about 11 sec
Ubuntu                   about 73 sec (What's wrong with it?????)

(ruby1.8.6, same h/w spec of FreeBSD and Ubuntu)

I couldn't find any configuration difference (dependent library, ruby
version... etc)

Why this strange performance drop occurs on Ubuntu?

Please help me to fix Ubuntu performance problem.
753dcb78b3a3651127665da4bed3c782?d=identicon&s=25 Brian Candler (Guest)
on 2007-05-04 09:46
(Received via mailing list)
On Fri, May 04, 2007 at 02:26:13PM +0900, J. Wook wrote:
>                                   time
> Why this strange performance drop occurs on Ubuntu?
To debug this, first run your loop separately for redirect_url only,
success_url only, invalid_url only, and error_url only. Maybe only one
these is suffering large delays. That will help narrow the problem.

My guess is it's something to do with DNS resolution. Check your
/etc/resolv.conf is identical between all three machines.
This topic is locked and can not be replied to.