Question

I have a single controller implementing my SOAP webservice API using the datanoise-actionwebservice (2.3.2). I am not using Rail as a web app or website to serve any static content at all - it is purely running as a webservice, with direct Mysql.real_connect based queries from the controller code. This is more from my lack of deeper understanding of how to use the model part of Rails, but more practically because the queries are pretty complex and easier to code.

This webservice further makes SOAP webservice calls to other legacy services, and replies back to the windows based webservice client apps.

Challenge is that I have so far used the default mongrel server to handle the multiple calls to my API across several terminals, but obviously need to redeploy mongrel as a cluster or use other setups such as passenger to improve the response time to the clients. I'm unable to find a simple HOWTO for achieving this or comparable approaches - most point to usage as a website/webapp, where the need for apache etc. is more for serving statick content and CSS etc., along with the ruby part.

Can anyone point me to a resource where I can setup the cluster to handle multiple webservice calls concurrently and process in the controller and respond. Does rails automatically instantiate a controller for each webservice request so that it gets done in parallel? Or do we need to rewrite using available libraries?

Any help/advice is much appreciated. I cannot rewrite anything - it needs to be in Rails2.3.5/Ruby1.8.7 - upgrades are not an option as this is already working in production, and datanoise itself doesn't seem to like 1.8.7+ or Rails 3 from what I can see.

Cheers!

Was it helpful?

Solution

Fundamentally, you need to run more than one Mongrel.

The mongrel processes will become your backend servers, and you will need to run a front-end load-balancing proxy.

The thing is, the advantage of the pure-Ruby single-threaded Mongrel is easy setup. Once you move beyond the easy-setup realm, you may as well deal with the complexity of running Passenger. Passenger will do the load balancing internally.

If it was me, I would compile nginx or tengine from source, as it does not include Passenger out-of-the-box. This is as simple as adding an argument to the configure script.

# gem install rake rack passenger --no-rdoc --no-ri
# exit
$ ./configure --add-module=`passenger-config --root`/ext/nginx
$ make
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top