3 ms·
A coworker and I were discussing this yesterday. Our Rails processes take about 50MB of memory each, and can handle only one request. Since our site hits a ba
by jluxenberg 17y ago
A coworker and I were discussing this yesterday. Our Rails processes take about 50MB of memory each, and can handle only one request. Since our site hits a backend DB that is sometimes slow to return results, requests can last minutes. We could build an out-of-band process to query the backend service and return results asynchronously, but that seems like overkill. However, it's easy for a handful of users to eat up all the connections quickly, if they are all making long-running requests.
It seems silly to have an entire Rails process tied up blocked on results from this backend service. And it seems like a rather severe limitation of Rails' architecture to require 50MB of memory per connection-handling process. How do large sites scale Rails?
- jplewicke 17y agoI haven't used it myself, but you may want to take a look at Mike Perham's Phat. It modifies Rails to use asynchronous I/O and several cooperating Fibers per-thread/process to speed up Rails significantly. http://www.mikeperham.com/2010/04/03/introducing-phat-an-asynchronous-rails-app/ http://www.mikeperham.com/2010/04/03/introducing-phat-an-asy... http://news.ycombinator.com/item?id=1240609 http://news.ycombinator.com/item?id=1240609 It
- kd5bjo 17y agoScroll down to the web architecture section to see how we do it at Justin.tv: http://highscalability.com/blog/2010/3/16/justintvs-live-video-broadcasting-architecture.html http://highscalability.com/blog/2010/3/16/justintvs-live-vid...