Common scenarios to avoid in OLTP

Source: Internet
Author: User

Database Design

Rule

Description

Value

Source

Problem Description

1

High Frequency queries has a high number of table joins.

>4

Sys.dm_exec_sql_text

Sys.dm_exec_cached_plans

High frequency queries with lots of joins can is too normalized for high OLTP scalability.

2

frequently updated tables having # indexes.

>3

Sys.indexes

Sys.dm_db_index_operational_stats

Excessive index maintenance for OLTP.

3

Big IOs

Table Scans

Range Scans

>1

Perfmon Object

SQL Server Access Methods

Sys.dm_exec_query_stats

A Missing index flushes the cache.

4

Unused Indexes.

Index not in Sys.dm_db_index_usage_stats. If an index is never used, it won't appear in the DMV sys.dm_db_index_usage_stats

Avoid Index maintenance for unused indexes.

Cpu

Rule

Description

Value

Source

Problem Description

1

Signal Waits

>25%

Sys.dm_os_wait_stats

Time in runnable queue is pure CPU wait.

2

Plan Reuse

<90%

Perfmon Object

SQL Server Statistics

OLTP identical transactions should ideally has >95% plan reuse.

3

Parallelism:cxpacket Waits

>5%

Sys.dm_os_wait_stats

Parallelism reduces OLTP throughput. Cxpacket indicates that multiple CPUs is working in parallel, dividing up the query in smaller pieces. Ordinarily a well tuned OLTP application would not parallelize unless an index is missing, there are an incomplete WHERE clause, or the query is not a true OLTP transaction.

Memory

rule

value

source

problem Description

1

page Life expectancy

<300 sec

perfmon object

sql server Buffer Manager

sql server Buffer Nodes

page life expectancy is the average number of   seconds a data Page stay s in cache.    low values could indicate a cache flush that's caused by a big read.  Pure OLTP workloads D o not issue big reads,   thus possible missing index.

2

page Life expectancy

drops by 50%

perfmon object

sql server Buffer Manager

page life expectancy was the average number of   seconds a data Page stays in cache.    Low values could indicate a cache flush that's caused by a big read.  Pure OLTP workloads does not issue big R EADS,   thus possible missing index.

3

Memory Grants Pending

>1

Perfmon Object

SQL Server Memory Manager

Current number of processes waiting for a workspace memory grant.

4

SQL Cache Hit Ratio

<90%

SQL Cache Hit ratio falls under 90% for sustained periods of time greater than Sec.

It is likely that large scans has to be performed, which in turn flushes out the buffer cache.

Io

Rule

Description

Value

Source

Problem Description

1

Average Disk Sec/read

>20 ms

Perfmon Object

Physical Disk

Reads should take 4-8 ms without any IO pressure.

2

Average Disk Sec/write

>20 ms

Perfmon Object

Physical Disk

Writes (sequential) can is as fast as 1 ms for transaction log.

3

Big IOs

Table Scans

Range Scans

>1

Perfmon Object

SQL Server Access Methods

A Missing index flushes the cache.

4

If Top 2 values for wait stats is any of the following:

Asynch_io_completion

Io_completion

Logmgr

Writelog

Pageiolatch_x

Top 2

Sys.dm_os_wait_stats

If top 2 wait_stats values include IO, there is an IO bottleneck.

5

Low bytes per sec.

Perfmon Object

Physical Disk

Blocking

Rule

Description

Value

Source

Problem Description

1

Block percentage

>2%

Sys.dm_db_index_operational_stats

Frequency of blocks.

2

Block Process Report

Sec

sp_configure Profiler

Report of statements.

3

Average Row Lock Waits

>100ms

Sys.dm_db_index_operational_stats

Duration of blocks.

4

If Top 2 values for wait stats is any of the following:

Lck_m_bu

Lck_m_is

Lck_m_iu

Lck_m_ix

Lck_m_rin_nl

Lck_m_rin_s

Lck_m_rin_u

Lck_m_rin_x

lck_m_rs_s

Lck_m_rs_u

lck_m_rx_s

Lck_m_rx_u

Lck_m_rx_x

lck_m_s

Lck_m_sch_m

lck_m_sch_s

Lck_m_siu

Lck_m_six

Lck_m_u

Lck_m_uix

Lck_m_x

Top 2

Sys.dm_os_wait_stats

If top 2 wait_stats values include locking, there is a blocking bottleneck.

5

High number of deadlocks

>5 per hour

Trace Flag 1204 to display in the errorlog and or the profiler deadlock graph.

If The deadlock occurs with the same participant SQL commands or operations multiple times, it's likely that there are A locking problem.

Network

rule

Description

value

< P class= "label" >source

problem Description

1

high Network latency coupled with a   application that have many round trips to the database.

output Queue Length >2

perfmon object:network Interface

indicates that the latency between the   application server and the DAT Abase is high.

could be caused by significant network   infrastructure between the application and the instance of S QL Server.

2

Network bandwidth is used up.

Packets Outbound Discarded

Packets Outbound Errors

Packets Received Discarded

Packets Received Errors

Perfmon object:network Interface

Dropped packets is detected.

In summary, given the high volume of identical small transactions that characterize OLTP, transactions per second and Reso Urce usage can be improved as follows:

    1. Database designs usually keep the number of indexes to a functional minimum as every insert, update, and delete incurs ind EX Maintenance.
    2. CPU can is reduced with plan reuse and join reduction.
    3. IO performance can reduced with good indexing, join reduction, and high page life expectancy.
    4. Memory is optimal when there was no sudden drops in Page life expectancy.
    5. Sorts can limited with index usage. That's, a certain sort order is supported by an index that is sorted the same, either ascending or descending.
    6. Blocking can reduced with the index design and short transactions.

Common scenarios to avoid in OLTP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.