Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

What are the best practices regarding hosting a web application on RingoJS/Rhino? Seeing as it's single threaded, blocking calls such as long-running queries/file-uploads/web-services will mean that every other request will hang.

As far as I can tell, I could

A.) Open a separate Ringo instance for processes I expect to block for a long time (ie, file transfers, network io) and proxy.

B.) Open about 10-20 Ringo instances and have Apache perform some sort of round-robin proxying based on request load of each process.

I'm just looking for info regarding the pitfalls of each and some approaches other people have taken. Naturally, the problem isn't limited to Ringo, so any input from people using similar environments that have "solved" this problem is greatly appreciated.

share|improve this question

migrated from stackoverflow.com Oct 26 '10 at 13:18

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 2 down vote accepted

First, let's get the premise correct: RingoJS is not single-threaded. RingoJS runs on the JVM which is perfectly capable of multi-threading and Ringo does not hesitate to leverage that capability!

That said, here's a quick rundown of your options for deploying RingoJS webapps:

  • Per default, RingoJS comes bundled with Jetty, a production-ready yet lightweight webserver written in Java. You can deploy your apps directly with Jetty. This is how ringojs.org is running, for example.

  • If you have an intrinsic mistrust to run anything but the most battle-hardened webservers in a user-facing position, just place a reverse proxy of your choice (Apache, nginx, Varnish, etc.) in front and proxy through to Jetty running in the back. This is a time-tested and flexible approach used in many a contemporary server-side web application framework.

  • Alternatively, you can use your preferred Java servlet container and deploy RingoJS webapps using the JSGIServlet coming with Ringo. This deployment is especially beneficial when you are already operating in a JEE environment.

All of those are viable possibilities. The choice is yours.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.