That being said, you don't need threads to build an asynchronous/real-time Rails app. Eg.: you can use https://github.com/jcoglan/faye as a middleware w/o thread.
Interesting. Do you mean that one can use a pub-sub architecture to design an asynchronous system, or that I can actually install some component of faye as a Rack middleware and deploy the code example I linked above in an asynchronous fashion?
--To view this discussion on the web visit https://groups.google.com/d/msg/thin-ruby/-/pnMu86hJ84cJ.
You received this message because you are subscribed to the Google Groups "thin-ruby" group.
To post to this group, send email to thin...@googlegroups.com.
To unsubscribe from this group, send email to thin-ruby+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/thin-ruby?hl=en.
On Nov 16, 2011, at 2:23 PM, Marc-André Cournoyer <macou...@gmail.com> wrote:
> Although your example would not work w/ Thin async callback because you are using sleep. Which is blocking the event loop. If what you really want to do is keep a connection opened will processing other requests, then the async callback will work
Does using the asynchronous callback model require a certain style of app development, or only the middleware stack?
my only goal is to allow one request which is waiting on IO (like a call to the DB or a remote service) to not block other requests. my understanding is that the only thing I need to do is make sure my app is threadsafe, and run thin in threaded mode. oddly I've seen essentially zero discussion about this type of deployment so I'm worried I'm missing something. maybe it's because all the folks doing threads also want parallel IO so they are using JRuby.
Does using the asynchronous callback model require a certain style of app development, or only the middleware stack?
my only goal is to allow one request which is waiting on IO (like a call to the DB or a remote service) to not block other requests. my understanding is that the only thing I need to do is make sure my app is threadsafe, and run thin in threaded mode. oddly I've seen essentially zero discussion about this type of deployment so I'm worried I'm missing something. maybe it's because all the folks doing threads also want parallel IO so they are using JRuby.
--M-A
--
You received this message because you are subscribed to the Google Groups "thin-ruby" group.
It's worth remembering that as long as you're using well written libraries (i.e. mysql2 instead of mysql, and so on), then rb_thread_select and MRIs green threads /are/ a basic fibered reactor pattern, whilst still providing an easy synchronous approach to development.In essence, what I'm saying is, using net/http or mysql2 with thin in threaded mode can work great.