This link has been bookmarked by 10 people . It was first bookmarked on 04 Apr 2006, by Wade Ren.
-
21 Sep 07
-
12 Aug 07
-
28 May 07
-
Ruby on Rails is not thread safe so there is a synchronized block around the calls to Dispatcher.dispatch. This means that everything is threaded right before and right after Rails runs. While Rails is running there is only one controller in operation at a time. This is why people typically have to run a small set of Mongrel processes (a “Pack of Mongrels”) to get good concurrency.
-
If you have long running actions then you’ll most likely have performance problems. You should look at BackgrounDRB as a very nice way to offload work to another process so that your Rails app can keep working.
-
- A request hits mongrel.
- Mongrel makes a thread and parses the HTTP request headers.
- If the body is small, then it puts the body into a StringIO.
- If the body is large then it streams the body to a temp file.
- When the request is “cooked” it call the RailsHandler.
- The RailsHandler sees if the file is possibly page cached, if so then it sends the cached page.
- Now you’re finally ready to process the Rails request. LOCK!
- Still locked, Mongrel calls the Rails Dispatcher to handle the request, passing in the headers, and StringIO or Tempfile for body.
- When Rails is done, UNLOCK!. Rails has (hopefully) put all of its output into a StringIO.
- Mongrel then takes this StringIO output, any output headers, and streams them back to the client super fast.
-
-
23 May 07
-
25 Apr 07
-
20 Jan 07
-
02 Jul 06
-
04 Apr 06
Would you like to comment?
Join Diigo for a free account, or sign in if you are already a member.