質問

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