Re: Threading Performance?



On Fri, Sep 30, 2005 at 12:20:07PM +0900, Jeff McNeil wrote:
> Greetings.
>
> I apologize if this has been answered somewhere obvious. I did a fair
> bit of Googling prior to piping up. If this has been addressed,
> please feel free to simply point and grunt!
>
> In a nutshell, I have concerns surrounding the Ruby threads
> implementation as it appears to be a home-grown system. How does
> would performance stack up against FreeBSD 5.x KSD threads? I've run
> into problems with the Python dummy_thread module before with respect
> to performance, especially when dealing with intensive IO. I have a
> bit of a fear that I'll have the same issue here.
>
> I've been tasked with writing a dynamic HTTPS/HTTP gateway of sorts,
> and as such, it ought to get quite busy in the network IO
> department. I'd like to take advantage of thread pooling and whatnot.
>
> I'd really love to use Ruby as I'm quickly falling in love with it -
> what a nice language.
>
> Thoughts?
>
> Jeff

I wrote a data collection system that gathers statistics from over
2000 servers every five minutes 24/7. This has both high network
usage patterns as well as high disk usage patterns.

I also had a 4 processor box (a Sun E4500). Ruby threads cannot
take advantage of a multiprocessor server.

In order to have each collection cycle finish within the 5 minute
window alloted, all 4 processors must be fully utilized.

The architecture that I settled on was similar to a threaded worker
pool, except instead of threads I used processes with the main
process acting as the scheduler and the child processes reading
work tasks from a distributed queue (Ruby makes this easy with
Rinda). This allows scaling both by adding more processors
(and processes) to the server OR because of Rinda (and dRB)
simply by adding more collection servers.

So far, this solution has been running over a year and a half
on the single 4 processor server with no unscheduled down time.

My take is don't use the Ruby threading model for
network intensive tasks. Rather think about using dRB
and process level parallelism. You might be suprised
at how well it works and how scalable this makes your
system.

Rick

--
Rick Nooner
rick@xxxxxxxxxx
http://www.nooner.net



.



Relevant Pages

  • threads and system calls
    ... I'm curious how ruby threads would do for a threaded network server. ... this application clients connect to the server via ssl and a simple ... turn makes https connections to yet another server, gets the response, ...
    (comp.lang.ruby)
  • ? regarding Executing/Spawning Ruby calls in parallel
    ... I have "X" number of databases running and I need to send a query ... request to the "X" number of servers and I want to do this in ... I need to wait until all the requests to each server is ... I tried Ruby threads but it doesn't ...
    (comp.lang.ruby)
  • Re: Fully parallel Scheme-based language w/ evaluator
    ... Windows Server 2003 and networks in simple - and irreverent - terms. ... If networking really is a big deal, ... Concepts and Terminology in Part I, and The Design and Deployment of Network ...
    (comp.lang.misc)
  • Re: Outgoing POP3 email missing/lost/not received
    ... Funny thing is that I have had this ISP for 8 years and it has always been ... It looks like when you last ran CEICW, you set the ISP's mail server to: ... Internet Connection Wizard. ... After the wizard completes, the following network connection ...
    (microsoft.public.windows.server.sbs)
  • Re: Logon Server Unavailable
    ... There are currently no logon servers available to service ... You use a office laptop to connect the office VPN, when you map a network ... you may receive this message: "This account is the ... The server is not configured for transactions"> "A domain controller for your domain could not be contacted" ...
    (microsoft.public.windows.server.dns)