This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
.png)
Improving .NET Application Performance and Scalability
J.D. Meier, Srinath Vasireddy, Ashish Babbar, and Alex Mackman
Microsoft Corporation
May 2004
Related Links
Home Page for Improving .NET Application Performance and Scalability
Send feedback to [email protected]
patterns & practices Library
How to Use This Checklist
This checklist is a companion to Chapter 14, "Improving SQL Server Performance"
SQL: Scale Up vs. Scale Out
.gif) |
Optimize the application before scaling up or scaling out. |
.gif) |
Address historical and reporting data. |
.gif) |
Scale up for most applications. |
.gif) |
Scale out when scaling up does not suffice or is cost-prohibitive. |
Schema
.gif) |
Devote the appropriate resources to schema design. |
.gif) |
Separate online analytical processing (OLAP) and online transaction processing (OLTP) workloads. |
.gif) |
Normalize first, denormalize later for performance. |
.gif) |
Define all primary keys and foreign key relationships. |
.gif) |
Define all unique constraints and check constraints. |
.gif) |
Choose the most appropriate data type. |
.gif) |
Use indexed views for denormalization. |
.gif) |
Partition tables vertically and horizontally. |
Queries
.gif) |
Know the performance and scalability characteristics of queries. |
.gif) |
Write correctly formed queries. |
.gif) |
Return only the rows and columns needed. |
.gif) |
Avoid expensive operators such as NOT LIKE. |
.gif) |
Avoid explicit or implicit functions in WHERE clauses. |
.gif) |
Use locking and isolation level hints to minimize locking. |
.gif) |
Use stored procedures or parameterized queries. |
.gif) |
Minimize cursor use. |
.gif) |
Avoid long actions in triggers. |
.gif) |
Use temporary tables and table variables appropriately. |
.gif) |
Limit query and index hint use. |
.gif) |
Fully qualify database objects. |
Indexes
.gif) |
Create indexes based on use. |
.gif) |
Keep clustered index keys as small as possible. |
.gif) |
Consider range data for clustered indexes. |
.gif) |
Create an index on all foreign keys. |
.gif) |
Create highly selective indexes. |
.gif) |
Create a covering index for often-used, high-impact queries. |
.gif) |
Use multiple narrow indexes rather than a few wide indexes. |
.gif) |
Create composite indexes with the most restrictive column first. |
.gif) |
Consider indexes on columns used in WHERE, ORDER BY, GROUP BY, and DISTINCT clauses. |
.gif) |
Remove unused indexes. |
.gif) |
Use the Index Tuning Wizard. |
Transactions
.gif) |
Avoid long-running transactions. |
.gif) |
Avoid transactions that require user input to commit. |
.gif) |
Access heavily used data at the end of the transaction. |
.gif) |
Try to access resources in the same order. |
.gif) |
Use isolation level hints to minimize locking. |
.gif) |
Ensure that explicit transactions commit or roll back. |
Stored Procedures
.gif) |
Use Set NOCOUNT ON in stored procedures. |
.gif) |
Do not use the sp_prefix for custom stored procedures. |
Execution Plans
.gif) |
Evaluate the query execution plan. |
.gif) |
Avoid table and index scans. |
.gif) |
Evaluate hash joins. |
.gif) |
Evaluate bookmarks. |
.gif) |
Evaluate sorts and filters. |
.gif) |
Compare actual versus estimated rows and executions. |
Execution Plan Recompiles
.gif) |
Use stored procedures or parameterized queries. |
.gif) |
Use sp_executesql for dynamic code. |
.gif) |
Avoid interleaving data definition language (DDL) and data manipulation language (DML) in stored procedures, including the tempdb database DDL. |
.gif) |
Avoid cursors over temporary tables. |
SQL XML
.gif) |
Avoid OPENXML over large XML documents. |
.gif) |
Avoid large numbers of concurrent OPENXML statements over XML documents. |
Tuning
.gif) |
Use SQL Profiler to identify long-running queries. |
.gif) |
Take note of small queries called often. |
.gif) |
Use sp_lock and sp_who2 to evaluate locking and blocking. |
.gif) |
Evaluate waittype and waittime in master..sysprocesses. |
.gif) |
Use DBCC OPENTRAN to locate long-running transactions. |
Testing
.gif) |
Ensure that your transactions logs do not fill up. |
.gif) |
Budget your database growth. |
.gif) |
Use tools to populate data. |
.gif) |
Use existing production data. |
.gif) |
Use common user scenarios, with appropriate balances between reads and writes. |
.gif) |
Use testing tools to perform stress and load tests on the system. |
Monitoring
.gif) |
Keep statistics up to date. |
.gif) |
Use SQL Profiler to tune long-running queries. |
.gif) |
Use SQL Profiler to monitor table and index scans. |
.gif) |
Use Performance Monitor to monitor high resource usage. |
.gif) |
Set up an operations and development feedback loop. |
Deployment Considerations
.gif) |
Use default server configuration settings for most applications. |
.gif) |
Locate logs and the tempdb database on separate devices from the data. |
.gif) |
Provide separate devices for heavily accessed tables and indexes. |
.gif) |
Use the correct RAID configuration. |
.gif) |
Use multiple disk controllers. |
.gif) |
Pre-grow databases and logs to avoid automatic growth and fragmentation performance impact. |
.gif) |
Maximize available memory. |
.gif) |
Manage index fragmentation. |
.gif) |
Keep database administrator tasks in mind. |
.png)
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
© Microsoft Corporation. All rights reserved.