SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Training
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


Tip Topics

All Tips
ADO.NET / ASP.NET
Administration
Analysis/OLAP Services
Application Development
Configuration
Components
ETL
Hardware
High Availability
Hints
Index
Misc
Operating Systems
Performance Tuning
Replication
T-SQL
Views

USEFUL SITES :

ASP.NET Tutorials
Windows and SQL Azure Tutorials
Cloud Hosting Magazine
SharePoint Tutorials
Windows Server Help

Write for Us

Share your SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

A High Level Comparison Between Oracle and SQL Server - Part ...
A High Level Comparison Between Oracle and SQL Server - Part ...
A High Level Comparison Between Oracle and SQL Server - Part ...
A High Level Comparison Between Oracle and SQL Server

More     
 
Latest FAQ's

Add Node to A SQL Server failover Cluster failed with invalid ...
SQL Server Destination remote server error
Setting Up Data And Log Files For SQL Server
Will Check Constraints Improve Database Performance?

More     
   
Latest Software Reviews

dbForge Review
Spotlight on ApexSQL Diff - Server-based database comparison tool ...
Spotlight on ApexSQL Data Diff - Server-based database comparison tool ...
Spotlight on ApexSQL Doc 2008

More     

tips >> performance tuning >> Using the SQL Server Profiler

Using the SQL Server Profiler

By : Brad McGehee
Apr 21, 2005

Page 2 / 6

The version of Profiler than comes with SQL Server 7.0 may not collect every event that SQL Server experiences. As events occur in SQL Server, they are first stored in a queue, then these events are moved to the Profiler for capture. If there are many events occurring, it is possible that the queue can fill up and events lost before they can be moved to Profiler. Although this is not a good thing, in practice it generally does not present too much of a problem because capturing every event is not always necessary (but sometimes it is).

In SQL Server 2000, this problem has been fixed, assuming you select the "Server processes SQL Server trace data" option, which is available from the "General" tab of the trace's property sheet. If you don't select this option, then you might lose trace events, just as you do in SQL Server 7.0. But if this option is selected, you will be guaranteed that no events will be lost. But, if you do choose this option, SQL Server will incur a heavier than normal load, which might affect the performance of your production applications. So only turn this option on if you need to guarantee no lost trace data. [7.0, 2000] Updated 8-7-2006

*****

Don’t run the Profiler on the same server you are monitoring, this can noticeably and negatively affect the server’s performance. Instead, run it on another server or workstation and collect the data there. [7.0, 2000, 2005] Updated 8-7-2006

*****

Whenever you start a trace using Profiler, producers (special code within SQL Server) are used to collect specific sets of events and pass them to a queue in SQL Server. The queue is a temporary holding area for captured events where they are held before being passed to the Profiler. To move the events from the queue to the Profiler, SQL Server creates a special thread to perform this task. If the producers increase the rate of captured events, causing the queue to fill up, SQL Server will automatically boost the priority of the threads, speeding the movement of events from the queue to the Profiler. This helps to prevent the queue from filling up.

But sometimes the producers send too many events to the queue (when the server you are profiling is very busy, and/or when you select too many events to capture), and the queue fills up. When this happens, the producers begin a short time-out period, allowing the queue to empty out. During this time-out period, the producers continue to collect events, but they are not written to the queue, instead, these events are lost.

To help prevent events from being lost under heavy load conditions, you can change the default queue settings. There are four different queue settings you can change:

  • Number of rows to buffer: Default value: 1000. Increasing this value will allocate more memory to the queue and help prevent data loss, but doing so takes memory away from SQL Server's other activities.
  • Server timeout (seconds): Default value: 5. This is the length of the time-out period that the producers use when the queue is full. By decreasing this amount, you reduce the amount of time that events are lost.
  • Boost Priority (%): Default value: 95. Indicates the point at which the thread moving events from the queue to the Profiler is increased. The higher this percentage, the more the queue fills before the thread priority is increased.
  • Reduce Priority (%): Default value: 90. Indicates the point at which the thread moving events from the queue to the Profiler is decreased. The lower this percentage, the emptier the queue before the thread priority is decreased.

Under normal circumstances you will not have to change these settings. But if you are profiling a lot of events from a very busy server, you may find that you are not capturing all events. If this is the case, you may want to experiment with some of these settings in order to reduce data loss. If you have extra memory in your server that is not being used by SQL Server, consider increasing the "Number of rows to buffer" setting. If you don't have the extra memory, you may want to consider changing the values for the "Boost Priority" and "Reduce Priority" settings. Microsoft recommends setting the "Boost Priority" to 2 and the "Reduce Priority" to 1 for heavy loads.

Like many settings, you will probably need to carefully experiment with various settings until you find the best for your particular environment and situation. Also, you may only want to use special settings for heavy user situations, not for use under normal loads.

To change these settings, go to the "Trace Properties" tab and click on the icon that looks like a server next to the "SQL Server" drop-down box. This brings up a dialog box where you can change these settings. [7.0, 2000] Updated 8-7-2006

*****

Many times, the output of a Profiler trace can be overwhelming. This can make it difficult to find what you are looking for within a trace. One way to help overcome this problem is to write the trace to a SQL Server table, then query the table directly using Query Analyzer or Management Studio. Assuming you know what you are looking for, this method can greatly speed up finding the data in the trace you want to find. [7.0, 2000, 2005] Updated 8-7-2006

*****

Since it is often impossible to manually tune every index and table in your database, the best way to spend your available "tuning time" is to identify those tables and indexes that your application uses the most. If you identify these, then you can focus your limited resources on hand tuning these heavily used objects.

So how to you identify these heavily used tables and indexes? One of the easiest ways to do this is to use the SQL Server Profiler. There is an event class called "Object: Opened." If you select this event class, you will get a trace of every object opened by SQL Server.

To make the trace easier to read, group the "text" data column. This way, you can easily see how many events have occurred for each object access. Alternately, you can store the trace in a SQL Server table, and then apply the appropriate GROUP BY query to get the results you want. [7.0, 2000, 2005] Updated 8-7-2006


<< Prev Page     Next Page>>    








C# Help and Tutorials | PHP MySQL Tutorial | Sharepoint Tutorial | Azure Tutorial | Cloud Hosting Magazine | ASP.NET Tutorials | Windows Server Help | Windows Phone Pro | Silverlight Ace | Visual Studio Tutorials | Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | SQL Server Training Videos | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 2010 Jude O'Kelly. All rights reserved