« CitrixCommunity.com Launched! | Main | Federation Reflection: A better way to do pass-through authentication? »

Please click here if you are not automatically redirected...

I get asked a lot about the message that users sometimes see when they first point their browser to a web interface site:

"Please click here if you are not automatically redirected."

The message sometimes flashes by in an instant but in other cases it can take between 5-10 seconds before the user is shown the WI logon page. The redirect code itself is just a BODY ONLOAD tag that bounces the user onto the .../auth/login.aspx page where they authenticate. But why does it sometimes take so long?

WI relies on ASP.NET scripts, which get compiled into temporary DLL's the first time they are requested. After the web service restarts or whenever the WI application pool is recycled, the DLLs all get unloaded and then have to be compiled again when the next user hits the web server. If your WI site is not getting hit very frequently during the day, then it is more likely to go into an idle state where the application pool unloads.

Once the scripts are compiled and the DLLs are in memory, subsequent requests are much faster: faster than the old ASP architecture where each script had to be parsed every single time an HTTP request came in.

By default, IIS 6.0 will unload a web application pool if it has been idle for 20 minutes. This means that if nobody hits the WI site on that server for 20 minutes, the next person that does use the site will experience the compilation delay.

IIS also recycles application pools by default once every 29 hours. Not sure where they came up with 29 hours as the value for this... the practical effect is that the application pool recycles every day but at a 5-hour offset from the day prior.

You can reduce the number of times the application pool unloads by increasing or disabling the idle timeout for the Application Pool named 'CitrixWebInterfaceAppPool' or 'CitrixWebInterface4.2AppPool'. If you have 4.0 and 4.2 installed on the same server you will have both application pools:

Right-click the app pool and choose Properties. On the Recycle tab, you can just clear the setting for recyclying the app pool every 29 hours:

Then view the Performance tab and configure the option "Shutdown worker processes after being idle for (time in minutes)". I usually just clear the checkbox so this never happens:

With these changes, the delay should only happen whenever the web server (or IIS) is restarted.

JayT

PS: While we're looking at that performance tab, be aware that if you increase the "Web Garden" number from 1 to 2 or higher you will break WI. Doing so creates multiple copies of the web application pool process, which from a session variable point of view is a lot like having two separate web servers with non-persistent load balancing taking place between them. When a user gets bounced from one thread to the other, the new thread does not have any of their session varialbes in memory and they see the dreaded error "Your session is in an inconsistent state."

TrackBack

TrackBack URL for this entry:
http://www.jaytomlin.com/cgi-bin/mt/mt-tb.cgi/20

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)