views:

116

answers:

3

Does anyone knows how to force WEBrick to process more than one request at a time? I'm using some Ajax on my page for long running database-related tasks and I can clearly see the requests are being processed in a pipeline.

+1  A: 

webrick only processes one request at a time, which is usually fine for development. If you want things to run in parallel have a look at mongrel_cluster or the awesome unicorn or passenger of course.

tliff
Ok, all of those are for plain ruby. What should I use to make it work with JRuby? I have some database connectivity that's only available in Java (no direct activerecord support for Teradata :( ) so I'm kind of bound to JRuby.
Matthias Hryniszak
I'd assume you would have to use some kind of application server like Tomcat or Glassfish.
tliff
A: 

You should definitely not be using WEBrick for long running requests. The best web server for the job would probably be Thin, as it's powered by EventMachine which makes it possible to write asynchronous code so that the server doesn't block.

+1  A: 

If you use JRuby, check out the GlassFish gem (stripped-down GlassFish server in gem form), the Trinidad gem (same thing using Tomcat), or various other options like warbler (produces .war files you can run directly or deploy to any app server). JRuby is the easiest way for sure to deploy a highly-concurrent application on Ruby, and makes the C Ruby options look rather primitive in comparison.

Charles Oliver Nutter
Thanks! Running it on Tomcat rather than on WEBrick was exactly what I needed.
Matthias Hryniszak