[Nitro] Nitro on Apache
Robert Mela
rob at robmela.com
Wed Oct 3 14:45:25 EDT 2007
Kirk Haines wrote:
> Yes. This brings up an interesting issue, though. 1 minute to render
> a page is horrific, and if everything is that slow, there are no good
> solutions. But if the app only has certain pages that are that slow,
> while the rest are fast, it brings up an interesting, solveable
> scaling quandry.
>
I didn't write it... just wanna make that clear... I inherited it and
have solved enough of it that at least users can get on to the system,
which gives them a chance to grumble about the speed.
This is the offending code in gems/mongrel-1.0.1/lib/mongrel.rb. I've
set num_processors in mongrel_cluster.yml to 1, and it seems a fairly
straightforward workaround to replace accept ( line 722 ) with a polling
loop:
def accept_workaround
reap_dead_workers
if worker queue length < max_processors
return accept
else
sleep 0.1 seconds # more properly: wait for a barrier condition
end
end
Gets me out of my current hell. A proper fix would have a barrier
condition replacing the sleep, but compared to what I'm up against now,
a 0.1 second polling loop is nothing.
Swiftiply looks good -- scanning the docs now. As an alternative, the
above, unless I'm missing something, would also mesh seamlessly with
mod_proxy_balancer.
- query worker_list.lengthand if it's greater than num_processors, b
721 while true
722 begin
723 client = @socket.accept
724
725 if $tcp_cork_opts
726 client.setsockopt(*$tcp_cork_opts) rescue nil
727 end
728
729 worker_list = @workers.list
730
731 if worker_list.length >= @num_processors
732 STDERR.puts "Server overloaded with
#{worker_list.length} processors (#@num_processors max).
Dropping connection."
733 client.close rescue Object
734 reap_dead_workers("max processors")
735 else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rob.vcf
Type: text/x-vcard
Size: 116 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/nitro-general/attachments/20071003/15d8c3a0/attachment-0001.vcf
More information about the Nitro-general
mailing list