Вопрос

I understand that Thin is built on top of EventMachine, which provides async IO. If I am using a rack framework like RoR or Sinatra and do some DB call (without using any special libraries), does that block the main event loop (given I am using Thin as a web server)?

Thanks

Это было полезно?

Решение

Yes it does.

Standard DB clients are made on top of Ruby's TCPSocket which will block main thread while it waiting response.

You should use patched clients which will replace TCP Connection to EM::Connection. Some of them are presented in EventMachine library itself

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top