Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS 7.5 web application first request after app-pool recycle very slow

We have our website running on two machines with iis 7.5 One works fine.

The other one how ever takes a really long time to process the first request after an app-pool recycle. It can take upwards of 60secs which is unacceptible since its going to be used as our production server.

I've checked the app-pool settings on the both servers and they are the same, and the webapp version on both servers is the same. I've run the task manager and resource monitor, add see a connection to the machine when I make the request but nothing else happens, iis doesn't even show the request in the logs untill its completed. I don't really know what its doing in the mean time.

Are there any traces of settings we can try to play with to fix this or find the problem. It's very puzzling.

EDIT: So I've got some more information now, finall got the failed request logs to work (had to give the user IIS_IUSRS permissions) but I've got some logs to see whats going on

The time lost is inbetween two seconds in the log file.

1. MODULE_PRECONDITION_NOT_MATCH    Name="ScriptModule-4.0", Precondition="managedHandler,runtimeVersionv4.0"            12:09:46.422 
2. VIRTUAL_MODULE_UNRESOLVED        Name="FormsAuthentication", Type="System.Web.Security.FormsAuthenticationModule"     12:12:04.390 

As you can see it takes over 2 minutes inbetween those two events, anyone encounted this before?

like image 597
MrJoeBlow Avatar asked Dec 17 '12 15:12

MrJoeBlow


People also ask

What happens when IIS application pool recycle?

Recycling means that the worker process that handles requests for that application pool is terminated and a new one is started. This is generally done to avoid unstable states that can lead to application crashes, hangs, or memory leaks.

What is the difference between IISreset and app pool recycle?

IISreset resets all application pools. Application pools are used to seperate processes. In earlier versions we always had to reset IIS, and so resetting ALL websites. When resetting an Application pool, only the websites configured to use that application pool are reset.

Why is IIS so slow?

An IIS or ASP.NET hang can cause your website to have slow page loads, timeouts, or 503 Service Unavailable errors. Hangs can be caused by blocked ASP.NET threads, bad configuration, or request queueing.


1 Answers

This is somewhat hard to tell whats going on on your other server, however here's a simple checklist you might want to reconsider:

  • Always pre-compiling your site, as opposed to copying it! you might gain a significant performance boost compiling your website before deployment: ASP.NET Precompilation Overview

  • Do not run the production application with debug="true" enabled, when debug flag is true in your web.config, Much more memory is used within the application at runtime, and since some additional debug paths are enabled, codes can execute much slower

  • Check your Web.config file to ensure trace is disabled in the <trace> section

  • IIS 7.5 comes with the Auto-Start Feature. WAS (Windows Process Activation Service) starts all the application pools that are configured to start automatically, ensure that your application pool is configured to AlwaysRunning in the IIS 7.5 applicationHost.config, check out here for more detail

  • Check out the ASPNET.CONFIG file to see if the configuration on both servers are still the same. Every asp.net server can be well configured by aspnet.config file located in the root of the framework folder

  • Ensure that Publisher Evidence for Code Access Security (CAS) is set to false in your aspnet.config file, This might increase the initial page load when you restart the ASP.NET app pool. you can read more about it here.

Here's how to disable checking for CAS publisher policy for an application:

<configuration>
    <runtime>
        <generatePublisherEvidence enabled="false"/>
    </runtime>
</configuration>
  • also you might want to try Application Initialization Module for IIS 7.5, this module also available on IIS 8.0 can decrease the response time for first requests by pre-loading worker processes
like image 56
Kamyar Nazeri Avatar answered Oct 05 '22 11:10

Kamyar Nazeri