Database Design

Rule

Description

Value

Source

Problem Description

1

High Frequency queries having 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 be   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 will not   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   have >95% plan reuse.

3

Parallelism: Cxpacket waits

>5%

Sys.dm_os_wait_stats

Parallelism reduces OLTP throughput. CXPACKET   indicates that multiple CPUs are 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 is an incomplete WHERE clause,   or the query is not a true OLTP   transaction.

Memory

Rule

Description

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 stays in cache.    Low values could indicate a cache flush that is caused by a big read.  Pure OLTP workloads do NOT issue big reads,   thus possible missing index.

2

Page life expectancy

Drops by 50%

Perfmon object

SQL Server Buffer Manager

Page life expectancy is the average number of   seconds a data page stays in cache.    Low values could indicate a cache flush that is caused by a big read.  Pure OLTP workloads do NOT issue big reads,   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 60 sec.

It is likely that large scans have 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 be 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 are 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

30 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 are 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 is likely that   there is a locking problem.

Network

Rule

Description

Value

Source

Problem Description

1

High network latency coupled with an   application that has many round trips to the database.

Output queue length >2

Perfmon object: Network Interface

Indicates that the latency between the   application server and the database is high.

Could be caused by significant network   infrastructure between the application and the instance of SQL 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 are detected.

In summary, given the high volume of identical small transactions that characterize OLTP, transactions per second and resource 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 index maintenance.
  2. CPU can be reduced with plan reuse and join reduction.
  3. IO performance can be reduced with good indexing, join reduction, and high page life expectancy.
  4. Memory is optimal when there are no sudden drops in Page Life Expectancy.
  5. Sorts can be limited with index usage. That is, a certain sort order is supported by an index that is sorted the same way, either ascending or descending.
  6. Blocking can be reduced with index design and short transactions.

Common scenarios to avoid in OLTP的更多相关文章

  1. Common Scenarios to avoid with DataWarehousing

    Database Design Rule Description Value Source Problem Description 1 Excessive sorting and RID lookup ...

  2. 8 Mistakes to Avoid while Using RxSwift. Part 1

    Part 1: not disposing a subscription Judging by the number of talks, articles and discussions relate ...

  3. Microsoft SQL Server Trace Flags

    Complete list of Microsoft SQL Server trace flags (585 trace flags) REMEMBER: Be extremely careful w ...

  4. Android Lint Checks

    Android Lint Checks Here are the current list of checks that lint performs as of Android Studio 2.3 ...

  5. (WPF) 基本题

    What is WPF? WPF (Windows Presentation foundation) is a graphical subsystem for displaying user inte ...

  6. Processing Images

    https://developer.apple.com/library/content/documentation/GraphicsImaging/Conceptual/CoreImaging/ci_ ...

  7. IMS Global Learning Tools Interoperability™ Implementation Guide

    Final Version 1.1 Date Issued:            13 March 2012 Latest version:         http://www.imsglobal ...

  8. 9.Parameters

    1.Optional and Named Parameters calls these methods can optionally not specify some of the arguments ...

  9. C# Development 13 Things Every C# Developer Should Know

    https://dzone.com/refcardz/csharp C#Development 13 Things Every C# Developer Should Know Written by ...

随机推荐

  1. MFC的自定义消息的定义与使用

    自定义消息的响应和资源消息的响应有很多类似之处:资源消息的响应是以资源的ID号作为标识的:自定义的消息要自己声明消息ID. 一.           定义: 第一步要声明消息: #define WM_ ...

  2. Windows程序设计(第五版)学习:第三章 窗口与消息

        第三章 窗口与消息 1,windows窗口过程:应用程序所创建的每一个窗口都有一个与之关联的窗口过程,用于处理传递给窗口的消息. 2,窗口依据窗口类来创建.窗口类标识了用于处理传递给窗口的消息 ...

  3. linux进程及进程控制

    Linux进程控制   程序是一组可执行的静态指令集,而进程(process)是一个执行中的程序实例.利用分时技术,在Linux操作系统上同时可以运行多个进程.分时技术的基本原理是把CPU的运行时间划 ...

  4. C++ JsonCpp 使用(含源码下载)

    C++ JsonCpp 使用(含源码下载) 前言 JSON是一个轻量级的数据定义格式,比起XML易学易用,而扩展功能不比XML差多少,用之进行数据交换是一个很好的选择JSON的全称为:JavaScri ...

  5. python json学习之路2-认识python种的json模块

    1.从python原始类型向json类型的转化过程,具体的转化对照如下: 2.从json到python的类型转化对照如下: 3.json提供四个功能:dumps, dump, loads, load ...

  6. 深入理解js——执行上下文

    什么是"执行上下文"?暂且不下定义,先看一段代码: 第一句报错,a未定义,很正常.第二句.第三句输出都是undefined,说明浏览器在执行console.log(a)时,已经知道 ...

  7. Warchall: Live RCE

    具体漏洞是:CVE-2012-1823(PHP-CGI RCE) 在地址后面加进参数运行对应的php-cgi 参数的行为 例如 index.php?-s 相参于/usr/bin/php53-cgi/p ...

  8. JS事件冒泡

    JavaSciprt事件中有两个很重要的特性:事件冒泡以及目标元素. 事件冒泡: 当一个元素上的事件被触发的时候,比如说鼠标点击了一个按钮,同样的事件将会在那个元素的所有祖先元素中被触发.这 一过程被 ...

  9. Eclipse+Mingw+Boost 环境搭建

    一.安装CDT插件 Eclipse是用Java的swt开发的,所以需要java虚拟机才能运行,jdk的配置方法网上一大堆,这里就不细说了.安装CDT的方法简单提一下,到Help->Eclipse ...

  10. 虚拟机VMware新增硬盘无法识别问题

    添加硬盘前的硬盘信息 在虚拟机中新增硬盘 添加后发现使用fdisk -l信息不变,新增的硬盘并没有识别,试过重启虚拟机硬盘就会识别出来.如果不想重启则按照如下方法: 先查看/proc/scsi/scs ...