[Mongrel] Handling multiple requests at once

Jeremy Wilkins jeremy at ibexinternet.co.uk
Fri Dec 7 09:18:56 EST 2007


Hi,

I'm trying to write a custom handler for mongrel. My understanding is  
that whilst rails is not multithreaded, mongrel is - does this mean  
it should be able to handle multiple requests at once?

I've written the following test code

class HelloHandler < Mongrel::HttpHandler
   def process(request, response)
     response.start(200) do |head, out|
       head["Content-Type"] = "text/html"
			(1..50).each do |i|
				puts "Loop #{i}"
				sleep 3
			end
			out.write("FINISHED")
     end
   end
end

uri "/hello", :handler => HelloHandler.new, :in_front => true

Which just sleeps for a while outputting a counter to the command  
prompt before finishing. If I request this file multiple times the  
requests are run synchronously, not in parallel? Is there anything I  
can do to make mongrel process the requests in parallel?

Thanks

jebw


More information about the Mongrel-users mailing list