From: Brian Candler Date: 2009-11-29T22:01:09+09:00 Subject: Re: Which server component? Tim Bennen wrote: >> 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. >> 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. Or you can use a hybrid approach: poll, block for up to 2 minutes (say), then reply with a message or 'no message available'. -- Posted via http://www.ruby-forum.com/.