To be able to go back to see how a server was utilizing it’s resources at a specific time, you need to enable “Performance Logging” within the Pefmon tool. The data collected can be instrumental in troubleshooting certain system and performance issues. What these instructions will do is to save Key Performance Counters in a file under C:\Perflogs so you can gather information from a specific point in time if and when it is needed.
To ensure capturing these counters will not affect performance, we will capture every counter in the following groups – the way Microsoft created the Perfmon capturing is that it will capture the entire group first, then only write the specific counters if you specify specific counters. Telling it to capture the whole Counter Group does reduce processing. The counters this process will collect are:
\Memory\* \Network Interface(*)\* \Paging File(*)\* \PhysicalDisk(*)\* \Process(*)\* \Processor(*)\* \Processor Performance(*)\* \Server\* \System\* \SQLServer:Access Methods\* \SQLServer:Buffer Manager\* \SQLServer:Databases(*)\* \SQLServer:General Statistics\* \SQLServer:Latches\* \SQLServer:Locks(*)\* \SQLServer:Memory Manager\* \SQLServer:SQL Statistics\* \Web Service(*)\*
This process will start the collecting at the top of every hour, collect these counters every 10 seconds for that hour, then start again writing to a new file. Doing this will keep the file size down and ensure that a server restart will only stop capturing data for at most 59 minutes.
Other options that were decided and the reasoning behind them are:
- Capture Every 10 Seconds – According to many professionals, capturing Windows® Performance Stats more frequently than 5 seconds can introduce statistical anomalies. On the flip side, setting it to a larger period of time can introduce issues with not collecting enough data. To keep logs at a reasonable 8-15MB per hour (depending on the server configuration), we chose to collect every 10 seconds (which is also a nice round number).
- Directory set to C:\Perflogs – This allows you to easily bypass the security settings on this folder and these files. Simply adjust the C:\Perflogs security and the files will also use these settings. If you put them in a sub-directory then the people that need access need to be in specific local groups on the server.
- Set the filename to SERVERNAME_Perflog_YYYYMMDDHH – Setting these logs to a specific pattern allows for easier manipulation/automation to be performed against them (future AppAdminTools products will utilize this pattern).
Adding the Perfmon Counter Log
Prior to adding the Counter Log, first open the Perfmon and ensure that there isn’t already a Counter Log that is already capturing data.
If there is an existing Counter Log and it is only capturing a minimal amount of data, that should be fine, but if it is capturing a lot of data, it might be wise to just combine the 2 – see what that one is capturing, ensure that the counters that it is capturing are the ones listed above, if not, document what it is capturing so you can add those to the new Counter Log, then stop and delete that Counter Log.
To add the new Counter Log, first you must edit the AppAdmin_Perf_W2K3.htm file that is located in this zip file. Open the file in Notepad (or another text editor) and Replace “SERVERNAME” with the actual name of the server – make sure you Replace ALL.
Once you Replace all the SERVERNAME entries and save the file, right click in Perflog’s Counter Logs page, then click on “New Log Settings From…”
Locate the AppAdmin_Perf_W2K3.htm file you edited previously and hit open. This will open a dialog to allow you to give it a specific name, you can just hit enter here to accept what we called it, otherwise note what you name it as you will need it when creating the scheduled task. Once you name it and hit OK, the import will then allow you to review the settings of the Counter Log, just hit OK to accept the defaults.
Scheduling the Perfmon Capture
To start the imported capture, you would simply run this command:
C:\Windows\System32\logman.exe start AppAdmin_Perf
Even though there is a “Schedule” tab within the PerfLog Capture Properties, we recommend to simply create a “Scheduled Task” that would start the Performance Capture every hour.
To do this, simply open Task Scheduler and add a task that is setup similar to these images:
In the above image, note the “Run as” account is set to “NT Authority\SYSTEM” – when you set it to this, the password is just blank.
Under the Schedule Tab, you will want to set the start time at 12:00AM, then hit the “Advanced” button. Here you can set the task to Repeat the task every 1 hours for the duration of the day (24 hours).
TIP: Once you setup this scheduled task, you can actually copy/paste it out to easily add it to another server. Just remember if you do this, ensure it is set to run under “NT Authority\SYSTEM”.