Ruby + FreeBSD = bandwidth killer?


#1

This is a bizarre situation. I have a program that makes heavy use of
Hpricot. The program uses the Daemons gem to break apart into multiple
processes all running essentially the same program, each working on a
different set of data.

The program runs fine on Leopard. However, when I run the same program
on a FreeBSD box with comparable hardware, it drains the life from my
bandwidth.

The FreeBSD machine is a bare-bones install of 6.3. I installed Ruby and
Ruby Gems, nothing else.

Any ideas?


#2

Hpricot. The program uses the Daemons gem to break apart into multiple

The program runs fine on Leopard. However, when I run the same program
on a FreeBSD box with comparable hardware, it drains the life from my
bandwidth.

has it anything to do with Daemons? I had a similar issue when running
a program in the background. With Daemons it was using up a 70% of my
RAM
for no reason. The same program runs without using much or no resources
without
Daemons (require ‘daemons’).

saji


Saji N. Hameed

APEC Climate Center +82 51 668 7470
National Pension Corporation Busan Building 12F
Yeonsan 2-dong, Yeonje-gu, BUSAN 611705 removed_email_address@domain.invalid
KOREA


#3

Saji N. Hameed wrote:

has it anything to do with Daemons? I had a similar issue when running
a program in the background.

I doubt it. As I said, I can run the same program on Leopard with no
issues.

RAM is a non-issue. Even with 10 of these processes going, each machine
has about 300 MB of available RAM (1 gig total).


#4

Have you got any netstat data between the two boxes?

netstat with -a, b, m, s might show some interesting diffs …


#5

Sean Mehan wrote:

Have you got any netstat data between the two boxes?

netstat with -a, b, m, s might show some interesting diffs …

Hmm… each of those show a ton of information. Not sure what you’d want
to look at.

Here’s a snippet of netstat -p tcp on Leopard:

Active Internet connections
Proto Recv-Q Send-Q Local Address Foreign Address
(state)
tcp4 0 0 192.168.1.100.54298 iw-in-f103.googl.http
SYN_SENT
tcp4 0 0 192.168.1.100.54297 eh-in-f99.google.http
FIN_WAIT_1
tcp4 0 0 192.168.1.100.54174 iw-in-f103.googl.http
CLOSE_WAIT
tcp4 0 0 192.168.1.100.54171 iw-in-f103.googl.http
CLOSE_WAIT
tcp4 0 0 192.168.1.100.54170 iy-in-f127.googl.http
CLOSE_WAIT
tcp4 0 0 192.168.1.100.54169 cf-in-f165.googl.http
CLOSE_WAIT
tcp4 0 0 192.168.1.100.54163 gx-in-f165.googl.http
CLOSE_WAIT
tcp4 0 0 192.168.1.100.54159 server.andreas-s.http
CLOSE_WAIT
tcp4 0 0 192.168.1.100.54158 server.andreas-s.http
CLOSE_WAIT
tcp4 0 0 192.168.1.100.54157 server.andreas-s.http
CLOSE_WAIT
tcp4 0 0 192.168.1.100.54154 server.andreas-s.http
CLOSE_WAIT
tcp4 0 0 192.168.1.100.52363 205.188.13.40.aol
ESTABLISHED
tcp4 0 0 192.168.1.100.52362 caim-m04b.blue.a.aol
ESTABLISHED
tcp4 0 0 192.168.1.100.52361 oam-m01b.blue.ao.aol
ESTABLISHED
tcp4 0 0 192.168.1.100.52360 205.188.8.196.aol
ESTABLISHED
tcp4 0 0 192.168.1.100.52358 kc-in-f125.googl.jabbe
ESTABLISHED
tcp4 0 0 192.168.1.100.54144 eh-in-f99.google.http
TIME_WAIT
tcp4 0 0 192.168.1.100.54143 iw-in-f104.googl.http
TIME_WAIT
tcp4 0 0 192.168.1.100.54142 eh-in-f99.google.http
TIME_WAIT
tcp4 0 0 192.168.1.100.54146 eh-in-f99.google.http
TIME_WAIT
tcp4 0 0 192.168.1.100.54145 iw-in-f104.googl.http
TIME_WAIT
tcp4 0 0 192.168.1.100.54149 iw-in-f104.googl.http
TIME_WAIT
tcp4 0 0 192.168.1.100.54148 eh-in-f99.google.http
TIME_WAIT
tcp4 0 0 192.168.1.100.54147 iw-in-f104.googl.http
TIME_WAIT
tcp4 0 0 192.168.1.100.54151 iw-in-f104.googl.http
TIME_WAIT
tcp4 0 0 192.168.1.100.54150 eh-in-f99.google.http
TIME_WAIT
… goes on with many more connections to Google…

Based on this bit of Ruby:

loop { Hpricot(open(‘http://google.com’)) }

I get similar output on the FreeBSD machine.