문제

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