Developer Dashboard SharePoint 2010

The Developer Dashboard is a new feature in SharePoint 2010 that helps a developer or system administrator to troubleshoot problems with page components and performance bottlenecks.

In order to monitor usage and resource consumption, Developer Dashboard is using the following counters:

  • Thread execution time
  • Number, duration, call stack information and query text of each SQL Server query generated by the page
  • Number, duration, and call stack information of each WCF call
  • URL or timer job name
  • Current user
  • Execution start time
  • Any of the preceding statistics for code enclosed by SPMonitoredScope (see Using SPMonitoredScope)

All the data that is processed by Developer Dashboard is stored in the SharePoint logs (14hivelogs).

Performance impact on the farm: when Developer Dashboard is enabled, 10 ms delay will be observed in the pages because of the data that is written in the ULS logs.

Adding Developer Dashboard to custom pages

You can add Developer Dashboard to your own page by either using the SharePoint v4.master page or adding two controls

a. Developer Dashboard Launcher – When the display mode is set to OnDemand, the Launcher displays the launcher icon. It can be used anywhere on the page. The div will define where the dashboard shows up:

Code:

<Sharepoint:DeveloperDashboardLauncher

ID=”DeveloperDashboardLauncher”

NavigateUrl=”javascript:ToggleDeveloperDashboard()”

runat=”server”

ImageUrl=”/_layouts/images/fgimg.png”

Text=”<%$Resources:wss,multipages_launchdevdashalt_text%>”

OffsetX=0

OffsetY=222

Height=16

Width=16 />

<div id=”DeveloperDashboard” class=”ms-developerdashboard” />

b. Page Rendering Control – must be located at the bottom of the page markup.

Code:

<SharePoint:DeveloperDashboard runat=”server” />

A. Dashboard Display Modes:

1. On – it can be visualized in all pages that use the default master page, creates the output at the end of the page content

2. Off – switches off developer dashboard and nothing is rendered

3. OnDemand – creates a DeveloperDashboard icon to make dashboard output visible as needed

B. Enable Developer Dashboard:

1. Using STSADM command

a. On Mode

STSADM –o setproperty –pn developer-dashboard –pv On

b. Off Mode

STSADM –o setproperty –pn developer-dashboard –pv Off

c. OnDemand Mode

STSADM –o setproperty –pn developer-dashboard –pv ‘OnDemand’

d. The last stsadm command will display the Developer Dashboard if one or more counters are exceeded:

STSADM –o setproperty –pn developer-dashboard –pv expensiveoperationsonly

2. Using PowerShell commands

a. On Mode

$DevDashboardSettings = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;

$DevDashboardSettings.DisplayLevel = ‘On’;

$DevDashboardsettings.Update()

b. Off Mode

$DevDashboardSettings = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;

$DevDashboardSettings.DisplayLevel = ‘Off’;

$DevDashboardsettings.Update()

c. OnDemand

$DevDashboardSettings = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;

$DevDashboardSettings.DisplayLevel = ‘OnDemand’;

$DevDashboardsettings.Update()

Using PowerShell commands you can add additional properties to Developer Dashboard. Here you have a complete list with properties: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spdeveloperdashboardsettings_members.aspx

Example:

$DevDashboardSettings = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;

$DevDashboardSettings.DisplayLevel = ‘OnDemand’;

$DevDashboardSettings.RequiredPermissions = ‘EmptyMask’;

$DevDashboardsettings.Update()

DevDashboardSettings.RequiredPermissions determines which users will see the developer dashboard. EmptyMask means all users will be able to access developer dashboard. Here you have a complete list of permissions http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx

Once you have executed the PowerShell OnDemand command, the following icon is displayed on the top right of the page. Click on it and the Developer Dashboard will be activated:

clip_image001

C. Dashboard Pane

Dashboard Pane has two main sections: Navigation (left side) and Properties (Right side) sections.

clip_image003

1. The Navigation section displays all of the SP Request objects that were generated from the page render. It starts with the GET Request for Home.aspx, and reports load times in milliseconds.

2. The Properties section has multiple subsections:

a. Web Server – provides information about time taken to render the page, current user, checks if the page is checked out or not, number of SPRequest and correlation id that can be used to find additional information in ULS logs

clip_image004

b. Asserts and Critical Events – displays errors and critical events associated with the event viewer

clip_image005

Click on the event ID to find more information about callstack

clip_image007

c. Database Queries – outputs every database query that happened during page render and time of execution

clip_image008

Click on the query link in order find additional information

clip_image010

d. Service Calls – Displays calls to web services (WCF)

clip_image011

e. SPRequest Allocations – Displays SP Request allocations and can be used to check whether or not SPRequest objects are properly set to dispose.

clip_image012

f. WebPart Events Offsets – Displays how long it takes for web parts to render

clip_image013

D. Developer Dashboard Features

I have tested some interesting features that can be implemented with Developer Dashboard:

1. Developer Dashboard configuration feature developed by Wictor Wilén

http://www.wictorwilen.se/Post/SharePoint-2010-Developer-Dashboard-configuration-feature.aspx

With this feature you can configure all of the options available for the dashboard:

· Display mode (On, Off, On Demand)

· Auto Launch of Developer Dashboard when critical events is tracked

· Enable the ASP.NET tracing output

· Configure the maximum amount of SQL queries traced

· Configure the maximum amount of critical events traced

· The required permission to view the Developer Dashboard (Full, None or Custom)

Installation steps:

· Download the feature from this link http://www.wictorwilen.se/Post/SharePoint-2010-Developer-Dashboard-configuration-feature.aspx

· Execute the following PowerShell command to add the solution:

Add-SPSolution -LiteralPath <SolutionPath>

clip_image014

· Execute the following PowerShell command to deploy the solution globally:

Install-SPSolution -Identity <SolutionName> -GACDeployment –CASPolicies

Connect to Central Administration -> General Application Settings and access the custom solution Development Settings

clip_image016

clip_image018

2. SharePoint 2010 Developer Dashboard Visualizer http://devdashvis.codeplex.com/

This solution extends the Developer Dashboard by plotting an interactive diagram with data from the Developer Dashboard, giving you an instant insight into where the bottlenecks are in your code.

clip_image019

E. Developer Dashboard Limitations:

a. Only calls to SharePoint databases are captured.

b. Only the code wrapped with SPMonitoredScope that resides on the front-end Web server appears on the Developer Dashboard.

c. Cannot be used for sandbox solutions

Thank you for reading this article.

Source of this article:

http://msdn.microsoft.com/en-us/library/ff512745.aspx Using the Developer Dashboard

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spdeveloperdashboardsettings_members.aspx SPDeveloperDashboardSettings Members

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx SPBasePermissions Enumeration

http://blogs.msdn.com/b/russmax/archive/2010/02/10/sharepoint-2010-logging-improvements-part-2-introducing-developer-dashboard.aspx SharePoint 2010 Logging Improvements – Part 2 (Introducing Developer Dashboard)

One thought on “Developer Dashboard SharePoint 2010

Comments are closed.