What is Mongrel?
Mongrel is a HTTP library and server for Ruby that is intended for hosting Ruby web applications of any kind using plain HTTP rather than FastCGI or SCGI.
Mongrel is not a SAPI interface but an full blown HTTP server designed to serve Ruby applications. As such, integration with LiteSpeed is straightforward using single “proxy” server external application format or load balanced “proxies”.
1) Create a Vhost under LiteSpeed.
2) Under the Vhost’s “External Apps” tab, create a new external application of type “Proxy”:
Name: MyMongrel1 <-- any name you want
Address: 127.0.0.1:88 <-- format: ip:port this is your Mongrel port
3) Under the Vhost’s “Contexts” tab, create a new context of type “Proxy”:
URI: / <-- the uri that will route requests to the Mongrel backend. "/" translate to all requests.
Web Server: MyMongrel1 <-- select the proxy you have setup in setup 2.
4) Restart and enjoy!
Setup is same as single Mongrel backend except for step 3.
3) Under the Vhost’s “Contexts” tab, create a new context of type “Load Balancer”:
type: Load Balancer
URI: / <-- the uri that will route requests to the mongrel backend. "/" translate to all requests.
Workers: proxy::MyMongrel1, proxy::MyMongrel2, proxy::MyMongrel3
The “Workers” field is where you need to list all the proxies/Mongrel backends you have created in step 2. Format for workers field:
proxy::PROXY1, proxy::PROXY2 ...
As Mongrel is another abstraction layer, it is slower than using Ruby LSAPI with LiteSpeed and much slower when Mongrel is used to serve static content as compared to LiteSpeed.
To mitigate the fact that Mongrel is not designed to efficiently serve static content, we highly recommend all Mongrel users to setup a “Static” “Context” with higher priority (lower number) with the LiteSpeed Vhost configuration pointing to the static image/css/etc files. This method allows LiteSpeed to offload all static delivery from Mongrel.