Performance Analysis with PSSDiag and SQL Nexus


Overview

Although there are many means of obtaining performance information from SQL, that’s exactly the problem. You can setup performance counters, look at statistics in SQL itself, look at logs, perform a trace in SQL, look at system information and so on. You can also correlate things like performance logs together with SQL traces to get a bigger picture. This is labor intensive though and only includes two sources of information. Wouldn’t it be great if you could compile all of the pertinent information together into meaningful reports and do so easily? Well you can with PSSDiag and SQL Nexus.

PSSDiag and SQL Nexus are not very intuitive and there isn’t a lot of documentation for these tools. You will also notice quite a lot of steps on this page. I know it may look complex, but the steps are actually quite simple and I could have condensed it into just a handful. However, I wanted to make sure anyone could do this.

Once you get this setup and do it a few times, it will give you an entirely new picture of your SQL Servers. You will be coming up with rapid answers without all the slaving over your system that you typically have to do to gather this information. You can do this! Let’s get started!

Obtaining the Software

  1. Visit the Microsoft Download site here to download the PSSDiag tool.
    1. Visit the support site to install and run this tool.
    2. Note the installation folder as you will need this later on.
  2. Go to the CodePlex site here and download the SQL Nexus tool.
    1. Visit the installation instructions to install SQL Nexus.
  3. Go to this CodePlex page to download and install ReadTrace.

Setting Up PSSDiag

  1. Run the PSSDiag Tool by selecting the “Pssdiag Configuration Manager” item in the Pssdiag folder in the Start Menu.
  2. Select the appropriate processor architecture from the images under Platform
    1. If unsure use Intel Inside Pentium for 32-bit or AMD 64 for 64-bit systems.
  3. Select the tab at the top of the window corresponding to the SQL Server version you will be collecting information against.
  4. In the Diag Manager window that appears set the Machine name field to the name of your SQL Server.
  5. Set the Instance name field to the instance name of your SQL Server or astrisk (*) if it’s the default instance.
  6. Set the Connect using fields appropriately for your authentication method.
  7. In Machine-wide Diagnostics check the following items you would like to capture data for with regard to the system SQL Server is running on.
    1. Event logs: Windows Event Logs.
    2. Startup: Windows system startup.
    3. Shutdown: Windows system shutdown.
    4. Perfmon: Performance Monitor counters selected in checked listbox below.
    5. Max file size: The maximum amount of data to capture in MB.
    6. Interval (sec): The polling sample window in seconds.
    7. Checked listbox: Check all perfmon counters to capture data for (check the SQL Server counters if you aren’t sure).
  8. In Instance-specific Diagnostics check the following items you would like to capture data for with regard to the specific SQL Server instance noted in the Instance name field (#3 above).
    1. SQLDIAG: Collect data from general purpose SQL collection utility for logs, data files, etc.
    2. Startup: SQL Server startup.
    3. Shutdown: SQL Server shutdown.
    4. Database Engine (tab):
      1. Trace: Gather SQL Server trace information.
      2. Template: Use a predefined tracing template to define collection events.
      3. Max file size: The maximum amount of data to capture in MB.
      4. Checked listbox: Define a custom set of collection events to gather data for.
  9. In Custom Diagnostics check the miscellaneous other tools you want to gather data from.
    1. Note: For each of the items in this listbox, highlight the item and read the Instructions window contents at the bottom of the tool window for more information.
    2. Rearrange the order of collection by using the up and down arrows.
  10. Save the configuration package and tools by clicking the Save button on the toolbar.
  11. Leave the existing paths and file names (should be \Build and \Customer folders).
  12. If another dialog appears asking you for the SQL Server version, select the appropriate option.
  13. Close the PSSDiag Tool.

Run the PSSDiag Collection Tool

  1. Open Windows Explorer and navigate to the PSSDiag installation folder you noted when installing PSSDiag (e.g. C:\Pssdiag).
  2. Navigate to the Customer folder inside of the root PSSDiag installation folder (e.g. C:\Pssdiag\Customer).
  3. Choose a folder you wish to use when running this collection tool, we’ll call it the collection folder (e.g. C:\Users\Me\Documents\PssDiag).
  4. Copy the pssd.cab file into your new collection folder.
  5. In Windows Explorer (it won’t work otherwise) double-click on the pssd.cab file and it will open as if it were just another folder.
  6. Select all of the files and copy them (i.e. CTRL+A then CTRL+C).
  7. Go back up a folder so you’re in your collection folder.
  8. Paste the files you just copied into the collection folder (i.e. CTRL+V).
  9. Note: Here is where you will want to spend a few minutes getting your system ready. You don’t want to be collecting information that’s not related to the issue, such as starting your development tools or closing all the open apps you have running.
  10. Once you’re ready to start collecting data, find the file called “pssdiag.cmd” and double-click it.
  11. You will see a command prompt window open up and possibly a System Information window pop up. Don’t do anything until you see the text, “SQLDIAG Collection started.  Press Ctrl+C to stop.”
  12. Once you see the above statement in the command window start your test scenario.
    1. This could be using an app that’s been running slowly and uses a database on the server you’ll be collecting information against.
    2. It could be running a set of scripts that aren’t performing the way you expect.
    3. Just focus on only performing the steps that you want to get more insight into.
  13. Once you are done running your test scenario, press CTRL+C.
  14. When the command prompt displays the prompt, “Terminate batch job (Y/N)?”, press Y and then ENTER.

Setting Up the SQL Nexus Tool

  1. Run the SQL Nexus Tool by selecting the “SQL Nexus” item in the “SQL Nexus 3.0″ (or some future version) folder in the Start Menu.
  2. Choose a SQL Server that you would like to store your SQL Nexus database on.
  3. In the Connect to Server dialog that pops up, enter the Server Name you just chose and authentication information to that server.
    1. If you have never started SQL Nexus before, it will automatically connect to the server and create the “sqlnexus” database.
    2. If you have created this database before, but deleted it and get a message that it still exists, check the SQL data folder to ensure the database and log files are deleted.
  4. You will now be presented with the SQL Nexus tool.

Running the SQL Nexus Tool

  1. Technically the tool is already running from the step you just perfomed; if not follow step 1 in the Setting Up the SQL Nexus Tool section above.
  2. Click the Import item in the Data panel on the left-side tool window.
  3. Set the Source path field to the “output” folder inside the collection folder you created previously and click OK if you browsed for the folder.
  4. If you have imported previously with this database click the Options link and select Drop Current DB Before Importing.
    1. If you don’t do this you’ll get an error since you can only perform one import into the database.
  5. Click the Import button.
  6. If you chose to drop the current DB before importing, click Yes on the “Danger” dialog box that appears.
  7. Wait for all of the Data Import steps to complete and then close the Data Import window.
  8. Now start opening items from the Reports panel on the left-side tool window.
  9. Navigate through clickable links in the reports to see all that the reports can show you.

Summary

That’s it! You’ve just setup the tools, collected data, analyzed it and viewed reports. After setting everything up for the first time you can start with step 9 in the “Running the PSSDiag Collection Tool” in the future. If you want to change what sources you’re collecting data from you’ll need to go back through all of the sections to create a new configuration and collection package.

Let me know what you think and if this is helpful by leaving a comment.

About these ads

2 thoughts on “Performance Analysis with PSSDiag and SQL Nexus

  1. Excellent effort! Thanks!
    I almost gave up on these tools. But so many recommend them that I understand it is worth the trouble to get it going. Unfortunately I still failed half way. I reached “Run the PSSDiag Collection Tool” step 10. I realized had to launch command prompt with Admin privileges. This helped me one step further. I launched pssdiag.cmd and noticed how SqlDiag tool was initiated. I then receive for lines with the following identical error: “SQLDIAG Failed to open System\CurrentControlSet\Control\Session Manager\Environment . Function result: 5. Message: Access is denied.”
    Any suggestions on how to overcome this?

    • Do you have local admin privileges? It is having trouble opening an area of the registry. You will have to run all software in administrative mode so it can access all the resources it needs. It will probably be launching other processes so you might just have to turn off access control all together. Let me know how it goes.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s