Friday, May 25, 2007

WTS Roaming Profile Slow to Load

This week, I had what has to be one of the most patient customers I’ve ever worked with. In working another issue, he reported to me that his Windows Terminal Server (WTS) logon took almost 30 minutes (!) to complete, and that he had been living with this for more than a year (!!). He had apparently been told by other support personnel that they couldn’t figure out the cause, and that he would have to live with it. Holy cow!

Well, I was amazed (to say the least), and I was eager to track down the cause. First, though, some detail on the WTS system. The server was running Windows Server 2003 Enterprise, SP1 and Citrix MetaFrame XP v1.0, although I strongly suspect that this would have been an issue without MetaFrame, and probably in other versions of Windows.

My first suspicion was that his profile was too large, or that he had some large files that changed a lot. Unfortunately, neither was the case. In fact, his profile was 32MB in size, and there were only a few files over 1MB in size. That clearly wasn’t the problem.

I decided to try copying his whole roaming profile to a server just to see how long it took. After all, this could be a network performance issue, right? WOW! It took more than 20 minutes to copy the whole thing. Why? Well, it turned out that he had more than 20000 files in his %USERPROFILE%\Cookies folder, and that took a while to copy. But still, that was less time than he was reporting.

I then remembered another customer with a profile load issue that seemed kinda weird at the time. Here’s the relevant 1509 Event description:

Windows cannot copy file \\server\share\wtsprofiles\username\Local Settings\Temp\5\Temporary Internet Files\Content.IE5\0ZDCVVFL\dickey;dir=newsweek[1].intl;dir=dickey;dcopt=ist;heavy=n;poe=yes;kw=dickey;pos=ad8;ad=125x125;fromrss=n;rss=n;sz=125x125;nwid=18519993_newsweek;ord=545299263383843130 to location C:\Documents and Settings\username\Local Settings\Temp\5\Temporary Internet Files\Content.IE5\0ZDCVVFL\dickey;dir=newsweek[1].intl;dir=dickey;dcopt=ist;heavy=n;poe=yes;kw=dickey;pos=ad8;ad=125x125;fromrss=n;rss=n;sz=125x125;nwid=18519993_newsweek;ord=545299263383843130. Possible causes of this error include network problems or insufficient security rights. If this problem persists, contact your network administrator.

DETAIL - The filename or extension is too long.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

For those of you unfamiliar with roaming profiles, this is a REALLY weird error. By default, the %USERPROFILE%\Temp folder doesn’t roam, and there is no way to make it roam. In fact, the file didn’t actually exist in the roaming profile store for this user. So why did we even get this error? It appears that the process that scans the TARGET folder structure for changes examines the entire structure, regardless of the exclusions. The exclusion is applied when actually copying the profile data. I may be off here, but that’s what it looks like.

I checked this user’s local Temp folder, and the number of files in the Temporary Internet Files was also quite large (I can’t recall the number). Based on that and the size of the Cookies folder, I think that the issue wasn’t one of copying, but rather was one of comparing. The sheer number of files to be checked was large enough that it was taking a REALLY long time to scan them all.

I had the user clean up his cookies and the Temporary Internet Files, and then asked him to try logging on again. He told me that after this change, his login took less than a minute to complete. What a change!

People often talk about slow profile loads being caused by large files in the roaming profile, and that’s a valid concern. However, the cause may well be the number of files in the profile, not the amount of data.

No comments: