I really really would like to be able to use rails on windows (not just developing, but in production). My preference would be to use linux, however the powers that be resist non microsoft os's like its nobodys business.
My first attempt is to use the new FastCGI for IIS. I figured this is my best bet since the more Microsoft technologies that I use, the easier this is to sell to my paycheck signers.
Setup was pretty simple, I followed these instructions (site not coming up as I write this, worked yesterday though)
The only issues I had were making sure permissions were setup on directory where my rails app was. To keep things simple I just gave Everyone modify rights to the whole folder.
My sample rails app is small, it calls a com object that returns xml which I return using render :xml
My first test is to create 4 threads and request the page from each
require 'open-uri'
NUM_THREADS = 4
URL = ''
threads = []
NUM_THREADS.times do |num|
t = Thread.new(num) do |count|
begin
puts "Starting thread #{count}"
resp = open(URL)
puts "Finished thread #{count}"
rescue OpenURI::HTTPError => err
puts "Failed on #{count}"
puts err.io.readlines
end
end
threads << t
end
threads.each {|t| t.join }
So far...umm not so good. Generally with 4 requests 1 maybe 2 will succeed with the rest giving me this error:
500 Server Error
Error 0x80070102
The FastCGI process exceeded configured activity timeout
The CPU is also pegged on the server when I do this.
So my first step was to try to up the timer for FastCGI. I found this forum post so I added this to my fcgiext.ini file
RequestTimeout=90
ActivityTimeout=60
I reran the tests (after restarting IIS) and was gretted with a Timeout::Error, so I tried setting the timeout like this in my test prog.
Finally all threads complete, but with a timeout of 90 seconds passed to open uri 3 of the 4 threads hit the timeout and had to retry in order to complete.
I didn't expect blazing performance, but yuck, this is silly. If I run the same tests but use webrick as the server on the machine all 4 threads get a nice quick result.