I have a rails app that runs an nmap scan on a host and reports the response via ajax. I use backtick to run nmap via my controller. What I've noticed is that if the nmap scan takes a while (say about 2 minutes), rails will block all request until the shell command finishes executing. My question is if there is a more effecient way to run shell commands via rails? Will I have to thread the nmap scan so the rails controller doesn't block until it receives a response?
People succeed in answering Don Miguel de los Platanos's questions 42% of the time (8 successes in 19 attempts).
Answers by: Jake McArthur
Use a load balancer and Mongrel or FastCGI on your production server to allow for multiple things to happen at once.
I stated that too simply. A load balancer can be anything from lighttp to Apache to an actual dedicated load balancer, and FastCGI or Mongrel or other should run under that. There are many tutorials for this on the web.
I think I understand where you going with this. Just post some tutorials and I'll send the reward over.
Some more info would be appreciated. Thanks.
The above link is a guide to getting a full production server up and running with Rails, a Mongrel cluster (basically just runs multiple instances of your Rails app, but on the same database of course), Apache (the server and load balancer), and Capistrano (basically assists in setting up a production server).
Thanks. I got it running now.