« Previous Next »

Thread: Limitations regarding InstanceMaxRequests and IdleTimeout IIS6 fcgiext 1.5

Last post 10-18-2009 6:23 AM by bg. 2 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (3 items)

Sort Posts:

  • 10-13-2009, 6:55 AM

    • bg
    • Not Ranked
    • Joined on 10-13-2009, 10:46 AM
    • Posts 2

    Limitations regarding InstanceMaxRequests and IdleTimeout IIS6 fcgiext 1.5

    Hi,

    I am running a Ruby on Rails application on Win server 2003 using IIS and fcgiext 1.5.The system runs on intranet and I am using IIS NT authentication to forward the user name to the rails application in order to facilitate pass through authorization. This part works fine and is the reason for choosing IIS and fcgi.

    The problem is slow response when a ruby process needs to start up and when the load increases the users experience not only frequent slow response, but also lots of HTTP 500 errors, mainly fcgi error 233 (no process is on the other end of the pipe)

    It takes about 10 sec for fcgi to load a Ruby process when a request comes in. As the load on the system increases, more processes are started. (As they are supposed to do) When starting up a new ruby process, the CPU load on the server goes up to 100% which increases the time to load a new process from 10 sec up to 20 sec.


    To minimize this problem I wanted to increase the life time of the ruby process by increasing the InstanceMaxRequests and the IdleTimeout.


    Regardless of how large number (>120) I put into InstanceMaxRequests, the instance shuts down after 120 requests. (Smaller number works fine) Some post on this forum suggests it’s depending on the load, but I get the same result regardless of load.

    Changing the default ResponseBufferLimit to 8388608 had a minor impact, as the max number of requests went from 100 to 120. Further increase of the limit had no effect on the max number.


    What is the actual max number of request you may set for this parameter?

    Any suggestions how to fix this?
     

    Regarding the IdleTimeout the longest idle time I could achieve was 20 minutes regardless of the parameter value.


    What is the actual max IdleTimeout?

    Any suggestions how to fix this?
     

    If I could make the loading of a Ruby instance a rare occasion, my tests show the system could handle high loads with fast response without the server CPU hitting the ceiling.
     

    [Types]

    *:1212958480=Ruby

     

    [Ruby]

    ExePath=D:\ruby\bin\ruby.exe

    Arguments=D:\rails\ruby\public\dispatch.fcgi
    IgnoreDirectories=0

    IgnoreExistingFiles=1

    QueueLength=1000

    MaxInstances=10

    InstanceMaxRequests=10000

    IdleTimeout=3600

    StderrMode=IgnoreAndReturn200
    ResponseBufferLimit=8388608 

    Thanks

     

  • 10-16-2009, 5:25 AM In reply to

    Re: Limitations regarding InstanceMaxRequests and IdleTimeout IIS6 fcgiext 1.5

    Hi,

    The InstanceMaxRequests is totally based on your web application and hardware performance. For instance, if every request is long running and CPU/Memory consuming, we may need to decrease the default value. There is indeed no a 'recommended' value for instanceMaxRequests. You have to evalute and perform some stress tests based on your specific web application to get a preferred setting.

    For IdleTimeout and long delay during restarting, I just think the behavior may be caused by IIS application pool's idle shutdown feature but not IdleTimeout in fcgiext.ini. Please open the site's application pool property. Check its default idle shutdown time. The default value is 20 mins which means: if there is no request comes in every 20 mins, IIS will shutdown this pool and any new incoming request after that will definitely encounters a 'delay' to wait IIS restart worker process for the app pool and reload everything.

    Thanks.

    WenJun Zhang - MSFT
    Sincerely
    Microsoft Online Community Support

    “Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. ”
  • 10-18-2009, 6:23 AM In reply to

    • bg
    • Not Ranked
    • Joined on 10-13-2009, 10:46 AM
    • Posts 2

    Re: Limitations regarding InstanceMaxRequests and IdleTimeout IIS6 fcgiext 1.5

    Dear WenJun Zhang,

    Thank you for answer. It was indeed the application pool´s idle shutdown feature that caused the shut down of the idle processes.

    I have now created a new application pool for my RoR site, trying to find settings that give acceptable performance for my application. Avoiding idle timeout of the Ruby processes in my pool helped to some degree but I have so far not been able to prevent the processes from dying after about 120 requests, regardless of the load I put on the IIS. So this is still a major problem.

    The typical behaviour when testing the site with low load is a response time, when a ruby process in the pool starts, of 10 seconds. The following consecutive requests render a response in 90-120 ms, until the process dies and starts over. One Ruby process occupies about 35 Mb of memory, and there is plenty of memory on my server to accommodate many Ruby processes at the same time. During my resent tests I have limited the number of instances to 4. (MaxInstances=4)

    In my application pool I now run with these settings:

    Recycling panel:  
    Recycle worker processes (in minutes): unchecked,
    Recycle worker processes (number of requests): unchecked,
    Recycle worker processes at the following times: unchecked,
    Memory recycling: Maximum virtual memory: unchecked,
    Maximum used memory: unchecked

    Performance panel:
    Idle timeout: unchecked,
    Request queue limit: unchecked,
    Enable CPU monitoring: unchecked, maximum number of worker processes: 4

    Health panel:
    Enable pinging: checked,
    Enable rapid-fail protection, unchecked,
    Startup time limit: 100,
    Shutdown time limit: 90

    Fcgiext.init:
    ExePath=D:\ruby\bin\ruby.exe
    Arguments=D:\rails\Ruby\public\dispatch.fcgi
    IgnoreDirectories=0
    IgnoreExistingFiles=1
    QueueLength=1000
    MaxInstances=4
    InstanceMaxRequests=100000
    IdleTimeout=43200
    StderrMode=IgnoreAndReturn200
    ResponseBufferLimit=8388608
    EnvironmentVars=RAILS_ENV:production

    Are there any other settings I could try to manipulate in order to make my ruby processes survive more than 120 requests, even at low load conditions (two requests per second)

    I really would appreciate suggestions how to resolve this problem.

    Thanks.

Page 1 of 1 (3 items)
Microsoft Communities