What you're experiencing should not be anything specific to IIS6; the first
request of a IronRuby-based app is going to take a longer amount of time
because IronRuby.Rack is compiling and running all the non-app code (Camping +
other Ruby libraries, in your case). In other words, it's like your starting
the server on the first run. IIS7 defaults to 110 seconds for a timeout, and I
assume IIS6 has the same, which should be way more than enough time to start
the app; a basic Rails app takes ~15 seconds to start up on my machine. How
long does your app take to start outside of IIS? There should be no difference
whether your running in IIS or not.
________________________________________
From: [email protected] [[email protected]]
on behalf of Martin Smith [[email protected]]
Sent: Saturday, September 12, 2009 2:58 AM
To: [email protected]
Subject: [Ironruby-core] IronRuby Rack Timeout causing issues at startup
Hello,
I wanted to let you know I was having all sorts of troubles getting
Rails to start reliably running on IIS6 (though I don't think IIS6 has
anything to do with it) and I had to increase the script timeout for
the very first load of the application.
I changed HttpHandler to the one i've included below. I think the
locking is right, but has the side effect of possibly a few of the
early scripts getting a longer timeout than expected. That's probably
ok, but I'm not sure it's an "enterprise ready" solution.
What do you guys think? Source included below.
Thanks,
Martin
--------------- begin --------------------
internal sealed class HttpHandler : IHttpHandler {
private readonly Stopwatch _watch = new Stopwatch();
private static bool _isFirstRequest = true; // added this
public bool IsReusable {
get { return true; }
}
public void ProcessRequest(HttpContext context) {
lock (this) {
if (_isFirstRequest) // added this if block
{
context.Server.ScriptTimeout = 600;
_isFirstRequest = false;
}
Utils.Log("");
Utils.Log("=== Request started at " + DateTime.Now.ToString());
_watch.Reset();
_watch.Start();
Handler.IIS.Current.Handle(new Request(new
HttpRequestWrapper(context.Request)),
new Response(new
HttpResponseWrapper(context.Response)));
_watch.Stop();
Utils.Log(">>> Request finished (" +
_watch.ElapsedMilliseconds.ToString() + "ms)");
}
}
}
------------- end --------------------------
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core
_______________________________________________
Ironruby-core mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ironruby-core