PERFORMANCE TUNING IN MICROSOFT SQL SERVER DBMS



Similar documents
SOLIDWORKS Enterprise PDM - Troubleshooting Tools

Microsoft SQL Server: MS Performance Tuning and Optimization Digital

Performance Monitoring with Dynamic Management Views

Solving Performance Problems In SQL Server by Michal Tinthofer

SQL Server Performance Tuning and Optimization

Query Performance Tuning: Start to Finish. Grant Fritchey

MS SQL Performance (Tuning) Best Practices:

One of the database administrators

Introduction. Part I: Finding Bottlenecks when Something s Wrong. Chapter 1: Performance Tuning 3

CHAPTER 8: OPTIMIZATION AND TROUBLESHOOTING

Optimizing Performance. Training Division New Delhi

WW TSS-02\03 MS SQL Server Extended Performance & Tuning

VirtualCenter Database Performance for Microsoft SQL Server 2005 VirtualCenter 2.5

PERFORMANCE TUNING FOR PEOPLESOFT APPLICATIONS

ESSENTIAL SKILLS FOR SQL SERVER DBAS

Chapter 15: AppInsight for SQL

Performance Management of SQL Server

Analyzing & Optimizing T-SQL Query Performance Part1: using SET and DBCC. Kevin Kline Senior Product Architect for SQL Server Quest Software

Mind Q Systems Private Limited

Course 55144: SQL Server 2014 Performance Tuning and Optimization

"Charting the Course... MOC AC SQL Server 2014 Performance Tuning and Optimization. Course Summary

Optimising SQL Server CPU performance

The 5-minute SQL Server Health Check

SQL Server 2012 Database Administration With AlwaysOn & Clustering Techniques

WhatsUp Gold v11 Features Overview

Administering Microsoft SQL Server 2012 Databases

Dynamics NAV/SQL Server Configuration Recommendations

SQL Server 2008 Designing, Optimizing, and Maintaining a Database Session 1

Enhancing SQL Server Performance

Perfmon counters for Enterprise MOSS

Course 55144B: SQL Server 2014 Performance Tuning and Optimization

About Me: Brent Ozar. Perfmon and Profiler 101

Guerrilla Warfare? Guerrilla Tactics - Performance Testing MS SQL Server Applications

VMware vcenter 4.0 Database Performance for Microsoft SQL Server 2008

Infor LN Performance, Tracing, and Tuning Guide for SQL Server

EZManage V4.0 Release Notes. Document revision 1.08 ( )

MOC 20462C: Administering Microsoft SQL Server Databases

Microsoft SQL Server performance tuning for Microsoft Dynamics NAV

DB Audit Expert 3.1. Performance Auditing Add-on Version 1.1 for Microsoft SQL Server 2000 & 2005

Predefined Analyser Rules for MS SQL Server

W I S E. SQL Server 2008/2008 R2 Advanced DBA Performance & WISE LTD.

Best Practices for Optimizing SQL Server Database Performance with the LSI WarpDrive Acceleration Card

Dynamic Management Views: Available on SQL Server 2005 and above, using TSQL queries these views can provide a wide variety of information.

Resource Governor, Monitoring and Tracing. On SQL Server

Performance Tuning and Optimizing SQL Databases 2016

SQL Server 2012 Query. Performance Tuning. Grant Fritchey. Apress*

SQL Server Performance Tuning for DBAs

FIGURE Selecting properties for the event log.

Microsoft SQL Server OLTP Best Practice

WITH A FUSION POWERED SQL SERVER 2014 IN-MEMORY OLTP DATABASE

Users are Complaining that the System is Slow What Should I Do Now? Part 1

SQL Server 2014 Performance Tuning and Optimization 55144; 5 Days; Instructor-led

DBMS Performance Monitoring

Windows 2003 Performance Monitor. System Monitor. Adding a counter

Performance Counters. Microsoft SQL. Technical Data Sheet. Overview:

SQL Server. DMVs in Action. Better Queries with. Dynamic Management Views MANNING IANW. STIRK. Shelter Island

Response Time Analysis

Improve Business Productivity and User Experience with a SanDisk Powered SQL Server 2014 In-Memory OLTP Database

Web Server (Step 1) Processes request and sends query to SQL server via ADO/OLEDB. Web Server (Step 2) Creates HTML page dynamically from record set

Microsoft SQL Database Administrator Certification

ArcSDE for Microsoft SQL Server Administration. Rob Stauder, ESRI

Microsoft SQL Server 2000 Index Defragmentation Best Practices

Only for Data Group Students Do not share with outsiders and do not use for commercial purposes.

SQL Best Practices for SharePoint admins, the reluctant DBA. ITP324 Todd Klindt

6231B: Maintaining a Microsoft SQL Server 2008 R2 Database

Destiny performance monitoring white paper

SQL Server 2016 New Features!

MS SQL Server 2000 Data Collector. Status: 12/8/2008

DMS Performance Tuning Guide for SQL Server

ImageNow for Microsoft SQL Server

Monitoring PostgreSQL database with Verax NMS

Database Maintenance Essentials

SQL Server Performance Assessment and Optimization Techniques Jeffry A. Schwartz Windows Technology Symposium December 6, 2004 Las Vegas, NV

W I S E. SQL Server 2012 Database Engine Technical Update WISE LTD.

MS SQL Server 2014 New Features and Database Administration

SQL Server Transaction Log from A to Z

Analyze Database Optimization Techniques

SQLintersection SQL123

SQL diagnostic manager Management Pack for Microsoft System Center. Overview

Whitepaper: performance of SqlBulkCopy

Windows Server 2012 Server Manager

PERFORMANCE TUNING WITH WAIT STATISTICS. Microsoft Corporation Presented by Joe Sack, Dedicated Support Engineer

Database Monitoring and Performance Tuning

Estimate Performance and Capacity Requirements for Workflow in SharePoint Server 2010

Throwing Hardware at SQL Server Performance problems?

PRO: Optimizing and Maintaining a Database Administration Solution by Using Microsoft SQL Server Practice Test. Version 2.

Course Outline. SQL Server 2014 Performance Tuning and Optimization Course 55144: 5 days Instructor Led

The Complete Performance Solution for Microsoft SQL Server

Case Study: Load Testing and Tuning to Improve SharePoint Website Performance

Director, Engineering Sybase ianywhere

Business Application Services Testing

Oracle Database 11 g Performance Tuning. Recipes. Sam R. Alapati Darl Kuhn Bill Padfield. Apress*

Managing Orion Performance

This presentation is an introduction to the SQL Server Profiler tool.

3 Setting up Databases on a Microsoft SQL 7.0 Server

SQL Server 2012 Optimization, Performance Tuning and Troubleshooting

Transcription:

Available Online at www.ijcsmc.com International Journal of Computer Science and Mobile Computing A Monthly Journal of Computer Science and Information Technology IJCSMC, Vol. 4, Issue. 6, June 2015, pg.381 386 RESEARCH ARTICLE ISSN 2320 088X PERFORMANCE TUNING IN MICROSOFT SQL SERVER DBMS Sapna Dahiya, Pooja Ahlawat M.Tech student, Department of CSE, R.N College of Engineering & Management Assistant Professor, Department of CSE, R.N College of Engineering & Management Sapna30july@gmail.com ABSTRACT: Now a day s database size in so rapidly growing up in the big organisation that performance tuning as coming an important subject for discussion. I am writing down this paper to discuss the importance of performance tuning in large-scale organizations, which host massive applications. Many of you have encountered problems of website going slow while surfing Internet. To enhance the performance of applications hosted in front end, it is very important to tune the databases in the back end. As the number of Users in the site started growing problem started occurring. As I have performed a vast research on this topic, therefore I want to help you do this by sharing my data access optimization experience during research work and share my findings with you in this article. I just hope this might enable you to optimize your data access routines in existing systems, or to develop data access routines in an optimized way in your future projects. 1. INTRODUCTION Performance tuning is the process of improving system s performance so that system s ability improves to accept higher loads. In this article I would mostly be focusing on performance tuning in MS SQL Server. I have highlighted different aspects, which should be considered while tuning your databases and common bottlenecks, which degrade the performance of your system. Please focus that primary goal of this article is "data access performance optimization in transactional (OLTP) SQL Server databases". But, most of the optimization techniques are roughly the same for other database platforms. I document focuses of the importance of appropriate Indexes for querying date in the tables. It focuses on best practices, which should be followed while designing the querying. Best techniques of query optimization, sql server performance tools such as sql server profiler and tuning advisor. It focuses on monitoring performance counters through perfmon and sql dmv s. Dealing with CPU bottlenecks and memory contention situations. SQL Database Engine is a highly IO intensive system so I have emphasized on gathering IO stats as well. Dealing with blocking and deadlock kind of situations also plays a major role in tuning the performance of out database engine. And managing system tables such as tempdb. I have also 2015, IJCSMC All Rights Reserved 381

discussed in brief several wait types, which should be monitored closely to tune performance, and little focus is also paid on instance level setting which enhance the performance of sql server 2. Various Bottlenecks which adversely impact the performance of System Bottlenecks occur when a resource reaches its capacity, causing the performance of the entire system to slow down. Insufficient or misconfigured resources, malfunctioning components, and incorrect requests for resources typically cause bottlenecks by a program. There are five major resource areas that can cause bottlenecks and affect server performance: physical disk, memory, process, CPU, and network. 2.1 Hard Disk Bottleneck Logical Disk\% Free Space This measures the percentage of free space on the selected logical disk drive. Physical Disk\% Idle Time This measures the percentage of time the disk was idle during the sample interval Physical Disk\Avg. Disk Sec/Read This measures the average time, in seconds, to read data from the disk Memory\Cache Bytes This indicates the amount of memory being used for the file system cache. There may be a disk bottleneck if this value is greater than 300MB. 2.2 Memory Bottleneck Memory\Available Mbytes This measures the amount of physical memory, in megabytes, available for running processes. If this value is less than 5 percent of the total physical RAM, that means there is insufficient memory, and that can increase paging activity. To resolve this problem, you should simply add more memory. 2.2.1 Checkpoint pages/sec It is triggered automatically by sqls server database engine to flush dirty pages to disk 2.2.2 High number of Lazy writes/sec: Lazy Writer come into picture whenever there is memory pressure on sql server. 2.2.3 High number of Page reads/sec : It s alarming when number of disk reads in more than cache reads. 2.2.4. Low Buffer cache hit ratio: A consistent value below 90% indicates that more physical memory is needed on the server. 2.2.5. Low Page Life Expectancy: Ideally this value should not be less than 300 seconds. 2.3 CPU Bottlenecks: High CPU Utilization is an important bottleneck, which adversely impact the performance of system. If SQL Server is using high CPU we need to terminate few batched responsible for it. 2.3.1. % Processor Time Processor time gives CPU Utilization in percentage 2.3.2 %Privilege Time gives time that processor take to executes system calls 2015, IJCSMC All Rights Reserved 382

2.4 Deadlocks and Blocking On SQL Server, blocking occurs when one SPID holds a lock on a specific resource and a second SPID attempts to acquire a conflicting lock type on the same resource We can check blocking through: SP_WHO2 ACTIVE; And Select * from sys.dm.exec_request; Blocking highly degrade the performance of system. Deadlock A deadlock occurs when two or more tasks permanently block each other by each task having a lock on a resource, which the other tasks are trying to lock To view deadlock information, the Database Engine provides monitoring tools in the form of two trace flags, and the deadlock graph event in SQL Server Profiler. Trace Flag 1204 and Trace Flag 1222 When deadlocks occur, trace flag 1204 and trace flag 1222 return information that is captured in the SQL Server error log. Trace flag 1204 reports deadlock information formatted by each node involved in the deadlock. Trace flag 1222 formats deadlock information, first by processes and then by resources. It is possible to enable both trace flags to obtain two representations of the same deadlock event. SQL Server itself handle deadlock situation by terminating the current batch involved in the deadlock and throwing error 1205. 3. How to tackle these bottlenecks 3.1 Applying proper indexing in the table columns in the Databases Well, some could argue whether implementing proper indexing should be the first step in the performance optimization process for a database. But I would prefer applying indexing properly in the database in the first place, because of the following two reasons: This will allow you to achieve the best possible performance in the quickest amount of time in a production system. Applying/creating indexes in the database will not require you to do any application modification, and thus will not require any build and deployment. Of course, this quick performance improvement can be achieved if you find that indexing is not properly done in the current database. However, if indexing is already done, it is still very important to fine-tune them regularly which involves following steps: 2015, IJCSMC All Rights Reserved 383

Make sure that every table in your database has a primary key. Create appropriate indexes either clustered or non-clustered depending upon he search criteria. CREATE INDEX IndexName ON tablename (LastName, FirstName) In case indexes are already created, look for index fragmentation. And depending upon the percentage of fragmentation either rebuild or reorganize your indexes. Index fragmentation can be identified through SQL DMVs and DBCC commands: SELECT * sys.dm_db_index_physical_stats; DBCC ShowContig If Index fragmentation is greater than 50% then rebuild indexes; ALTER INDEX ALL ON TableName REBUILD WITH (FILLFACTOR=90,ONLINE=ON) ; Else Reorganize Index: ALTER INDEX ALL ON TableName REORGANIZES; 3.2 QUERY OPTIMIZATION In SQL Server Query Processing, Query Optimization is one of the most important tasks which database engine performs. 2015, IJCSMC All Rights Reserved 384

SQL Server optimizer uses up to date stats to optimize query and choose the best available execution plan. Statistics contain information about relations. Therefore statistics should be accurate and up to date. This can be done through the stored procedure SP_UPDATESTATS 3.3 Using SQL Server Performance Tools 3.3.1 SQL Server Profiler and Tuning Advisor Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for monitoring an instance of the Database Engine or Analysis Services. You can capture and save data about each event to a file or table to analyze later. For example, you can monitor a production environment to see which Stored Procedures are affecting performance by executing too slowly. Tuning advisor helps to get the performance report that is generated by SQL Profiler and provide the appropriate indexing. It takes one or more SQL statements as input and invokes the Automatic Tuning Optimizer to perform SQL tuning on the statements. 3.3.2 SQL Query Analyzer: Microsoft SQL Server 2000 SQL Query Analyzer is a graphical tool that allows You to: Create queries and other SQL scripts and execute them against SQL Server databases. (Query window) Quickly create commonly used database objects from predefined scripts. (Templates) Quickly copy existing database objects. (Object Browser scripting feature) Execute stored procedures without knowing the parameters. (Object Browser procedure execution feature) Debug stored procedures. (T-SQL Debugger) Debug query performance problems. (Show Execution Plan, Show Server Trace, Show Client Statistics, Index Tuning Wizard) Locate objects within databases (object search feature), or view and work with objects. (Object Browser) Quickly insert, update, or delete rows in a table. (Open Table window) Create keyboard shortcuts for frequently used queries. (Custom query shortcuts feature) Add frequently used commands to the Tools menu. (Customized Tools menu feature) 2015, IJCSMC All Rights Reserved 385

3.3.3 SQL DMV s SQL DMV s means SQL dynamic management views. By querying a single DMV, sys.dm_os_performance_counters to be precise, you can collect counter information that you would receive from PerfMon for the various SQL Server counters. SQL DMV s in it self a vast subject to cover up. It can be used to capture any performance counter whether related to OS performance, index fragmentation, locking, deadlocking, wait types, system infi etc. 4. Conclusion The principle objective of performance tuning is to improve the performance of SQL Server so that he can process queries faster and make better use of system resources. Performance tuning now a days is very hot research topic for researchers and data analysts. In this paper I presented common performance bottlenecks and their troubleshooting. And we concluded that for enhance the performance of sql database engine it is very important to have proper indexes created and fine tune them periodically. Secondly it is very important to measure the performance of system proactively on regular basis using different performance measurement tools and troubleshoot them to enhance the throughput of system and ensure proper utilization of resources. References: 1. SQL Server 2012 Query Performance Tuning (Kindle Edition) by Grant Fritchey 2. SQL Server Query Performance Tuning Distilled By Sajal Dam (Author) 2nd Edition 3. SQL Server 2008 Query Performance Tuning Distilled By Sajal Dam (Author), Grant Fritchey (Author) 4. Microsoft SQL Server 2014 Query Tuning & Optimization by Nevarez (Author) 2015, IJCSMC All Rights Reserved 386