When creating applications in EventMachine I use asynchronous libraries so I don’t block EventMachine. For example using em-postgres instead of pg. Do I need to use asynchronous libraries when using thin and rails? If so then how does active record work?
When creating applications in EventMachine I use asynchronous libraries so I don’t block EventMachine.
Share
You need Eventmachine compatible libraries for anything that is blocking. Rails isn’t async by default, but it has been demonstrated that it can be modified into being so. I would be careful going down this road though as it is still unconventional and may not perform how you expect on your production infrastructure (the Heroku Bamboo stack for instance is always a “dyno per request”, nullifying the benefits of this async model).
You need to look at your stack as a whole and ask if you really need this. A conventional threaded setup in conjunction with delayed jobs may prove to be a simpler and as equally effective solution.