Travis Lingenfelder
Travis is a Senior Lead Consultant for Catapult Systems and blogs about Microsoft technologies including SharePoint, but is passionate about all things relating to technology. Travis is a MCTS for SharePoint Server 2007 and 2010, application development and configuration.

Performance Counters Timeouts and Load Testing with Visual Studio 2008   

Tags: Visual Studio, Testing
Technorati Tags: ,

 

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: ,
 
Posted by  Travis Lingenfelder  on  6/18/2009
15  Comments  |  Trackback Url  | 0  Links to this post | Bookmark this post with:        
 

Links to this post


Trackback from  David Broussard  on  8/20/2009  1:34 PM
A Guide to SharePoint Performance Testing (Part I) – What is “Acceptable” Anyway? 

[...] Recently I was involved in a couple of engagements to perfor ... [...]






Pingback from  [RESOLVED]Load and performance testing using .net 2008 | Asp Forum  on  9/10/2014  12:53 PM

Comments


Jeff Dalton  commented on  Friday, November 06, 2009  8:01 PM 
Thanks for the info, this was very helpful and solved one of my biggest frustrations with Visual Studio Load Tests.


Eris  commented on  Thursday, December 10, 2009  3:43 PM 
Your hints have helped me fix an issue I've been struggling with for days. Thanks!


Travis Lingenfelder  commented on  Thursday, December 10, 2009  3:48 PM 
Glad I could help.


Andrew Milsark  commented on  Wednesday, January 13, 2010  4:07 PM 
Do you have any idea on how to perform these tests across domains? I.e. I don't have the same user account on my local machine as the SharePoint server. My local domain is domainA Sharepoint is domainB


Travis Lingenfelder  commented on  Thursday, January 14, 2010  9:13 AM 
Andrew, you will probably need to setup a trust relationship between the two domains.


Soven  commented on  Monday, March 22, 2010  10:09 PM 
Thanks. This was helpful.


Arshad  commented on  Monday, June 21, 2010  7:00 AM 
Hello,

This solution works for VS 2008. But again I am struggling with VS 2010.

First thing, there is no VSTestHost.exe.config file in VS 2010 but i found similar file in the name VSTestConfig.exe.config. I added same <appsettings> node to it but it does not work.

Please help me out if you have any inputs on this.

Thank you.


Travis Lingenfelder  commented on  Monday, June 21, 2010  11:56 AM 
I have not yet tried doing any performance testing with VS 2010 but I do plan on doing so in the not too distant future. When I do, I will create a new blog post for 2010 performance testing.


sumeet  commented on  Sunday, April 10, 2011  5:35 AM 
Hey Travis,

Excellent stuff and nice step wise debugging.

I was also facing the same problem (was unable to retrieve performance counters) but after increasing the timeout in the config file it got resolved.

I believe many people face this problem.

Keep posting such nice stuff.


kishan  commented on  Tuesday, August 16, 2011  5:43 AM 
Hi Travis,
while doing load test I am adding the server counter settings but it doesnt work,I am getting the error as
ERROR:
LoadTestCounterCategoryNotFoundException,The performance counter category 'Memory' cannot be accessed on computer 'HTTP://192.168.1.6' (The network path was not found) ; check that the category and computer names are correct.
Please help me out if you have any inputs on this. Thank you.
Please confirm in which config file we need to do the necessary modifications......

KISHAN


Divya  commented on  Monday, January 16, 2012  3:44 AM 
i have vs2010 , server 2008 can u please manage solution for the same .. its urgent i m not getting out of this typeperf comand action prompt error no valid counters warning


Anum  commented on  Tuesday, January 31, 2012  11:37 PM 
Im using VS2005, i got error while running load test after adding enable logging and increasing counter timeout statement in VSTestHost.exe


lms_  commented on  Thursday, July 26, 2012  11:44 AM 
For vs2010, see it here:
http://blogs.msdn.com/b/rubel/archive/2011/06/04/issues-while-collecting-counters-during-load-test-execution.aspx


Daniel Suarez  commented on  Wednesday, November 28, 2012  2:56 AM 
For Visual Studio 2010, open the file Devenv.exe.config in the folder C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE


chitra  commented on  Wednesday, December 12, 2012  7:18 AM 
we dont find "VSTestHost.exe.config " mentioned in C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE

Name *:
URL:
Email:
Comment:


CAPTCHA Image Validation