# Net::HTTP performance difference: FreeBSD vs. Ubuntu?

**URL:** <https://www.ruby-forum.com/t/net-http-performance-difference-freebsd-vs-ubuntu/103320>\
**Category:** Ruby\
**Created:** [May 4, 2007, 7:26am UTC](https://www.ruby-forum.com/t/net-http-performance-difference-freebsd-vs-ubuntu/103320 "2007-05-04T07:26:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JSWook](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d6d6ee/32.png) [@JSWook](https://www.ruby-forum.com/u/JSWook)\
**Post date:** [May 4, 2007, 7:26am UTC](https://www.ruby-forum.com/t/net-http-performance-difference-freebsd-vs-ubuntu/103320/1 "2007-05-04T07:26:12Z")

</div>

Strange ruby network performance drop examined on Ubuntu.

I made a simple HTTP testing code like below.

redirect\_url = “[http://www.talk-with-hani.com/feed](http://www.talk-with-hani.com/feed)”  
success\_url = “[http://www.daum.net](http://www.daum.net)”  
invalid\_url = “[http://www.daauumm.net](http://www.daauumm.net)”  
error\_url = “[http://errorurl1234.tistory.com](http://errorurl1234.tistory.com)”

start\_time = Time.now  
downloaded = 0

5.times do

begin  
uri = URI.parse(redirect\_url)  
r = Net::HTTP.get\_response(uri)  
c += r.body.size  
rescue Exception =\> e  
puts e.class  
end

… iterate for success\_url, invalid\_url, error\_url

end

puts “Total: #{downloaded/1000} KB, #{Time.now - start\_time} seconds”

Result was… very strange.

```
                              time

```

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.

---

<div class="post-metadata">

**Author:** ![JSWook](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d6d6ee/32.png) [@JSWook](https://www.ruby-forum.com/u/JSWook)\
**Post date:** [May 4, 2007, 9:46am UTC](https://www.ruby-forum.com/t/net-http-performance-difference-freebsd-vs-ubuntu/103320/2 "2007-05-04T09:46:49Z")

</div>

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