I am really confused now.
The FAQ says - Mongrel uses one thread per request.
So it can handle multiple requests (not surprising).
What you are suggesting is that my archiving method is trying to make
another http req. call within same http request?
I can see the wget requests in the mongrel (development.log). Clearly,
its not blocking these requests.
However, it is blocking other http requests (if I try to access my
application from a browser, then it times out or waits forever).
So it is not processing other requests. This could be because server has
reached max. number of connections.. (just one possibility).
I tried Passenger and it is really cool. However, there seems to be some
serious problem with my archiving code. When I run my app. using
passenger and try archiving method then, system slows down and I had to
reboot it forcefully.
The wget seems to make infinite calls to the server.
I am posting my archiving code for ref.:
----------------
def generate_archive
dir = "/tmp/topicsys/#{self.id}"
title = self.title.gsub(/^\s+/, '').gsub(/\s+$/, '').gsub(/\s+/,
'-')
id = self.id
host = "#{RAILS_ENV}_HOST".upcase.constantize
url = url_for :host => host, :controller => :topics, :action =>
:show, :id => id
logger.info "Generating topic - (#{title}) archive '#{dir}'."
pid = fork do
`wget --page-requisites --html-extension --convert-links
--no-directories --recursive --level=1 -np --directory-
prefix=#{dir} #{url};`
#`mv #{dir}/#{id}.html #{dir}/index.html;`
`zip -mj #{dir}/#{title}.zip #{dir}/*;`
end
Process.detach(pid)
end
----------------
Any clues?
Jeff Burlysystems wrote:
> 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 ....).
>
>
> 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
>
--
Posted via http://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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---