If you have a single instance of mongrel running your rails app, then
it is essentially "single threaded" when it comes to handling requests
(see comments in 
http://weblog.rubyonrails.org/2006/5/18/interview-with-mongrel-developer-zed-shaw
or http://mongrel.rubyforge.org/wiki/FAQ or ....).

Like I mentioned before, you'll need to setup a second instance of
mongrel to specifically handle those recursive httpclient calls back
into your app under dev env.  If you decide to go this route, you'll
likely want to dev a ruby (or capistrono) script for start/stop/
restart/status of the two dev env mongrel instances: one for your main
dev env running on port 3000(?), and one for your internal httpclient
calls running on port 3001(?), and then mod your internal httpclient
call code to hit port 3001 instead of 3000.

Another alternative would be to setup your dev env to run via
mod_rails/passenger, something like
http://accidentaltechnologist.com/ruby/replicating-rails-project-setup-on-development/
and the single-threaded-blocking issue goes away.

Jeff

On Apr 23, 10:07 am, Carlos Santana <rails-mailing-l...@andreas-s.net>
wrote:
> Thanks for the insight.
> Yes, it is a dev. environment with a single mongrel server (if thats
> what you mean by single instance).
> But, doesn't mongrel handle HTTP requests in a multi-threaded manner?
>
> I tried to move this code to my controllers and had another 
> problem:http://www.ruby-forum.com/topic/185134
>
> Any clues how does the rails handle model-controller code?  Any
> suggestions on placement of code to get optimum performance from rails
> framework in addition/parallel to MVC arch. style?
>
> -
> CS.
>
>
>
> Jeff Burlysystems wrote:
> > Are you seeing this behavior while running your rails app under a
> > typical development environment setup, ie a single mongrel instance of
> > the dev env running?  If so, then the blocking/hanging is due to the
> > fact that your archiving meth is trying to make an httpclient call
> > (using wget) back into your single-thread/-process rails app which can
> > only handle one request at a time.
>
> > If this is the case, you'll need to setup/run a second instance of
> > your dev env (or launch your archiving meth via script/runner, or
> > setup your dev env to run under mod_rails/passenger, or ...)
> > specifically to handle your archiving httpclient requests.
>
> > Jeff
>
> > On Apr 21, 5:29 am, Carlos Santana <rails-mailing-l...@andreas-s.net>
>
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to