From: Tim Bennen Date: 2009-11-30T02:12:22+09:00 Subject: Re: Which server component? >>> Yes. And for initial testing, you can run the rack app directly under >>> mongrel or thin or even webrick (rackup will start these servers for >>> you) >> Okay, I read: "One popular configuration is to run Apache 2.2 as a load >> balancer using mod_proxy_balancer in conjunction with several Mongrel >> instances, > ... > > Ignore that. Write your application as a rack application (just a single > Ruby object with a 'call' method). Then test it using the built-in > mongrel/thin/webrick handler. When you're happy with it, *then* look at > ways of deploying a rack application. At the moment, Phusion Passenger > (under either apache or nginx) and Unicorn (under nginx) look like good > options and both are much simpler than messing around with multiple > application instances started manually and bound to different ports. Okay, I will do it that way. But I should prepare the load balancing, so I think I will use one apache as a load balancer and one mongrel/rack combination. Is the Mongrel webserver included into Rack? I don't think so, only the "gateway" between a Mongrel and Rack? >>> Note that HTTP limits you to exactly one response per request. That is, >>> the server can't send back asynchronous unsolicited responses to the >>> client. If you want to do that with HTTP, you'd have to get the client >>> to send a request and block waiting for a response (aka 'COMET') or poll >>> periodically. >> Does that mean, the client establish a connection and only(!) if the >> client requests something, there will be one response from the server? >> So, it is not possible that the server send a message without(!) a >> request from the client? > > Correct. So the client must send a request GET /messages (say). If the > server responds immediately with 'no message available' then the client > must poll periodically. If the server blocks and doesn't send a response > until there is one, then you get COMET. If you're running COMET with > something like Apache or nginx in front, you need to beware that they > may time out idle connections, there may be some tweaking to do. Hm, that's a problem, because if something happened on the server, and the user should be notified, I have to poll every 2-3 seconds and that's a lot of data, because the clients could be mobile devices and that's expensive. Is there a Ruby Comet implementation? > Or you can use a hybrid approach: poll, block for up to 2 minutes (say), > then reply with a message or 'no message available'. Okay, that卒s also a possible solution... Using Rack/Mongrel or Apache/Mongrel/Rack the connection could be established as persistent? Thanks a lot! Regards. -- Posted via http://www.ruby-forum.com/.