Handle multiple requests at one time

Hi,

I have the following problem: My application contains a mechanism to
administrate some external services via a SOAP-API. If a user submit a
SOAP-Request, he is waiting for the SOAP-Response (it's necessary to
show him the response). While this time the Rails application is
'blocked' – another users can't do anything parallel. What is the best
way to avoid this situation (~ to process many requests at one time)?
Thanks & best regards

It depends on the number of simultaneous requests you expect to have going. If you’re using Passenger, it will spawn new processes when it needs to, other users will never know about one process being blocked. The same applies for mongrel cluster etc if you balance correctly.

If you expect a lot of long running processes, you should process them in the background. There’s several background processing solutions for Rails, like Nanite (which uses RabbitMQ) etc. What you basically do is pass on the longrunning method to an external agent and run it asynchronousle. Once the job is finished, the agent will execute a callback in your Rails app (which can be anything you would normally do in a Rails app). It means the user can launch webservice requests, do something else and then be notified once the result is available.

Best regards

Peter De Berdt