Applications

Performance Counters Timeouts and Load Testing with Visual Studio 2008

 

While using Visual Studio 2008 to do a load test of a SharePoint web site, I was having problems retrieving performance counters from the servers that I was trying to test.  The tests were configured as local tests without a test rig.  After I setup the web test and load test, the first time that I ran the test, everything was fine.  I got values from the performance counters on the servers and my graphs showed the information that I wanted.  Every test that I ran afterwards though, I was lucky if I got performance counter results from anything other than the local machine that was executing the test.

When the tests were run, I could see that there were 3 errors. Clicking on the error to see more details gave me a window with an error message like:

The performance counter category ‘Memory’ cannot be accessed on computer ‘WEB01’ (Timed out trying to read performance counter category ‘Memory’ on computer ‘WEB01’); check that the category and computer names are correct.

Searching on the web for this error message I could not find a whole lot, at least nothing that seemed useful.  After I while I started finding some blog posts that would give little bits and pieces that I used to help me along the way.  This blog takes all of those bits and pieces and puts them all together. [References at the end]

Performance Monitor

One of the first things that I tried was to make sure that I could retrieve the performance counters from the remote servers from my local machine.  I opened Performance Monitor and added counters from the remote servers.  Event though it took a minute to enumerate the list of counters after connecting to the server, all seemed well.  At this point, I decided to start a load test from Visual Studio while performance monitor was already connected to the machine.  As soon as I started the load test performance monitor froze for several seconds. 

Firewall Exceptions

Either turn off the local firewall or enable the rules for Performance Logs and Alerts in the Windows Firewall with Advanced Security snap-in.

Performance Monitor Users Local Security Group

Make sure that the user account that VSTestHost.exe runs as is a member of the Performance Monitor Users local security group on the server that is being monitored.

Enable logging for the VSTestHost.exe

Open the file VSTestHost.exe.config in the folder C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE and add the following:

<system.diagnostics>
  <trace autoflush="true" indentsize="4">
      <listeners>
         <add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="c:\VSTestHost.log" />
      </listeners>
  </trace>
  <switches>
      <!– You must use integral values for "value".  Use 0 for off, 1 for
           error, 2 for warn, 3 for info, and 4 for verbose. –>
      <add name="EqtTraceLevel" value="3" />
  </switches>
</system.diagnostics>

Increase the Counter Timeouts

Open the file VSTestHost.exe.config in the folder C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE and add the following (sets a 1 minute timeout):

<appSettings>
     <add key="LoadTestCounterCategoryReadTimeout" value="60000"/>
     <add key="LoadTestCounterCategoryExistsTimeout" value="60000"/>
</appSettings>

Connect to the IPC$ Share on the Remote Machine

Create a persistent connection to the remote server.

net use \\web01\ipc$ /user:domain\user /persistent:yes

TypePerf.exe

Open the command prompt and use the typeperf.exe command-line utility to  query the counters on the remote machine.

typeperf –q –s web01

I realized that I was on the right track when it took almost 10 minutes to retrieve the list of counters.  At this point, I went to talk to the Microsoft TAM that is on-site with the client.  He tried the same thing but since he was having name resolution issues from his machine, he used the IP address instead of the host name and instantly got results to my amazement.  I quickly went back to my desk and tried the same thing and it worked.  I then tried it by host name and it worked also.

typeperf –q –s 192.168.1.100

 

Everything continued to work fine until I rebooted my workstation.  After rebooting the workstation I had to re-connect to the IPC$ share and run typeperf with the IP address.

References

http://social.technet.microsoft.com/Forums/es-ES/vstswebtest/thread/f2731bdb-4538-4bb1-ba99-e2708ad29745
http://www.eggheadcafe.com/software/aspnet/33336016/problem-with-typeperf-and.aspx
http://social.technet.microsoft.com/Forums/en-US/vstswebtest/thread/692f7471-c791-47fd-b93c-9990001a8fe4

 

del.icio.us Tags: ,

15 Comments

  1. Jeff Dalton November 6, 2009
  2. Eris December 10, 2009
  3. Travis Lingenfelder December 10, 2009
  4. Andrew Milsark January 13, 2010
  5. Travis Lingenfelder January 14, 2010
  6. Soven March 22, 2010
  7. Arshad June 21, 2010
  8. Travis Lingenfelder June 21, 2010
  9. sumeet April 10, 2011
  10. kishan August 16, 2011
  11. Divya January 16, 2012
  12. Anum January 31, 2012
  13. Daniel Suarez November 28, 2012
  14. chitra December 12, 2012

Leave a Reply