I’ve been moving more and more pages over to NetAdminTools, and the render time is starting to take a long time.
=> Booting WEBrick => Rails 2.3.4 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server [2010-07-20 06:29:17] INFO WEBrick 1.3.1 [2010-07-20 06:29:17] INFO ruby 1.8.7 (2009-12-24) [i686-linux] [2010-07-20 06:29:17] INFO WEBrick::HTTPServer#start: pid=20168 port=3000 ^C[2010-07-20 06:29:23] INFO going to shutdown ... [2010-07-20 06:29:23] INFO WEBrick::HTTPServer#start done. Exiting |
Getting my RoR install to switch from WEBrick to Mongel was as easy as a couple of gem install commands:
root:/opt/mcjr/config# gem install mongrel Building native extensions. This could take a while... Building native extensions. This could take a while... Successfully installed gem_plugin-0.2.3 Successfully installed daemons-1.1.0 Successfully installed fastthread-1.0.7 Successfully installed cgi_multipart_eof_fix-2.5.0 Successfully installed mongrel-1.1.5 5 gems installed Installing ri documentation for gem_plugin-0.2.3... Installing ri documentation for daemons-1.1.0... Installing ri documentation for fastthread-1.0.7... No definition for dummy_dump |
Start up Mongrel:
root:/opt/mcjr# ./startitr => Booting Mongrel => Rails 2.3.4 application starting on http://0.0.0.0:5867 root:/opt/mcjr# |
Install mongrel cluster:
root:/opt/mcjr/script# gem install mongrel_cluster Successfully installed mongrel_cluster-1.0.5 1 gem installed Installing ri documentation for mongrel_cluster-1.0.5... Installing RDoc documentation for mongrel_cluster-1.0.5... root:/opt/mcjr/script# |
I have struggled a lot in the past to get mongrel_cluster to start at boot. I had to put mongrel_rails in my path (I cheated and made a symbolic link) and I added this init script:
/usr/local/bin/mongrel_rails cluster::start -C /opt/mcjr/config/mongrel_cluster.yml |
What I’m doing to render the pages is I pull the article numbers and create shell scripts that contain wget commands that I throw into the background. I then execute them five hundred at a time with 2 worker processes for Nginx and 40 RoR application servers (Mongrel). One trick I used was that after I’d spun off 400 processes I waited until there were no more wget processes before I started rendering more. My load gets up above 20 on my dual core, which is about as hard as I should push it before the load is counterproductive. It seems to have trimmed a couple of minutes off of my WEBrick sequential rendering.