On Aug 14, 1:52 pm, Frederick Cheung <[email protected]>
wrote:
> On Aug 11, 12:27 pm, "Yaroslav G." <[email protected]> wrote:

Thank you Fred for your answers!

>
> Personally I worry slightly about ruby's ability to handle several
> thousand IO streams. Does it use efficient select alternatives like

Non blocking IO is not only needed when you plan to implement chat
application.  It is also a god thing to consider if your application
have to work in highly concurrent environment, like shared hosting
servers. Old technique of dedicating a process for every client
request has proven wrong. Additionally non blocking IO solver problems
of slow client and slow operations within Ruby script.

> epoll or queues on platforms that support them? The last time I did
> something like this I wrote the comet part as a C++ daemon. When
> events like a message being posted occurred, the rails code notified
> the C++ daemon, that in turn notified any clients that had registered
> an interest in the relevant event.
>
> I'd also worry about how your model handles the case where your web
> front ends are spread across several servers - if the request with a
> new chat message arrives at server A but some of the waiting fibers
> are on server B, how does the message get passed across ?

Spreading nodes completely depends on a backend used to store and pass
messages - whether it would be RabbitMQ, database, etc. We only added
non blocking eventmachine support. We have almost all peaces working,
except ability to push data from the script. Our worker uses Rack to
interact with Rails, and Rack does not seem to provide any way to
return partial data to the server. So there is no ability to flush
some part of response to client and send a remaining part later. Still
working on a solution. Possibly the protocol have to be improved.

> I think with event machine you do pretty much have to give yourself
> over entirely to event machine and do everything using the event
> driven mechanisms it provides.

Yes, already implemented it this way. Entire server loop within a
worker is now replaced by an eventloop. Will see how it handle the
load.

Thanks again!

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to