My Ubuntu slice is now running 3 instances of the Typo blog engine.

After working through the excellent technical articles, mongrel clusters and surviving a reboot and apache vhosts, rails and mongrels, I install and ‘served’ the Typo instances as-per those articles.

Which means each Typo blog is served by a cluster of 2 mongrel processes:

  • Typo Blog #1 - ports 8001 and 8002
  • Typo Blog #2 - ports 8003 and 8004
  • Typo Blog #3 - ports 8005 and 8006

I quickly noticed that my slice is running slow as a dog with all these mongrels (haha), and ‘top’ shows that each processes typically uses about 30MB of memory!! Wow!

Now I understand that mongrel is single threaded, thus can only process a single request at a time. So a cluster is used to load-balance requests off to each process in the cluster.

I guess that the processes don’t share much (any?) memory space, because that is a LOT of memory for a pretty simple App.

I knew Ruby was inefficient when Richard was prototyping Termites in; the performance boost after he wrote the same algorithms in Java was massive, but it was interesting to see it first handy :-D Anyway getting off topic.

Typo can cache pages as static HTML and Mongrels is not even hit. So I realised that my crappy little blogs don’t need to process more than one RoR request at a time.

I re-built all the Mongrel cluster configurations to use 1 port instead of 2:
mongrel_rails cluster::configure -e production -p 8002 -N 1 … etc …

And I updated the apache virtual site config for each blog, so that requests are only proxied to the single port:
<proxy balancer://typo-jl-sg>