Common scenarios to avoid in OLTP
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:
- Database designs usually keep the number of indexes to a functional minimum as every insert, update, and delete incurs index maintenance.
- CPU can be reduced with plan reuse and join reduction.
- IO performance can be reduced with good indexing, join reduction, and high page life expectancy.
- Memory is optimal when there are no sudden drops in Page Life Expectancy.
- 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.
- Blocking can be reduced with index design and short transactions.
Common scenarios to avoid in OLTP的更多相关文章
- Common Scenarios to avoid with DataWarehousing
Database Design Rule Description Value Source Problem Description 1 Excessive sorting and RID lookup ...
- 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 ...
- Microsoft SQL Server Trace Flags
Complete list of Microsoft SQL Server trace flags (585 trace flags) REMEMBER: Be extremely careful w ...
- Android Lint Checks
Android Lint Checks Here are the current list of checks that lint performs as of Android Studio 2.3 ...
- (WPF) 基本题
What is WPF? WPF (Windows Presentation foundation) is a graphical subsystem for displaying user inte ...
- Processing Images
https://developer.apple.com/library/content/documentation/GraphicsImaging/Conceptual/CoreImaging/ci_ ...
- IMS Global Learning Tools Interoperability™ Implementation Guide
Final Version 1.1 Date Issued: 13 March 2012 Latest version: http://www.imsglobal ...
- 9.Parameters
1.Optional and Named Parameters calls these methods can optionally not specify some of the arguments ...
- 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 ...
随机推荐
- 5.Makefile的原理及应用
1.概念 目标:目标顶格写,后面是冒号(冒号后面是依赖) 依赖:依赖是用来产生目标的原材料. 命令:命令前面一定是两个Tab,不能是定格,也不能说多个空格.命令就是要生成那个目标需要做的动作. 2.基 ...
- 27、初步探索echarts源码
1.首先发现随笔中凡是和echarts相关的点击率都特别高,于是乎就接着写了echarts因为感觉要转点击率 首先声明我并不是专业做前端的,所以如果有些说得不对的地方,希望前端大神们出来指正 首先发现 ...
- ios category,protocol理解
category: 向现有的类中增加方法,同时提供方法的实现,现有类不需要做任何改动. protocol:(相当于Java或C#中的接口interface,当很多类都要需要类似的方法,但是方法具体实现 ...
- avalon2学习教程15指令总结
avalon的指令在上一节已经全部介绍完毕,当然有的语焉不详,如ms-js.本节主要总结我对这方面的思考与探索. MVVM的成功很大一语分是来自于其指令,或叫绑定.让操作视图的功能交由形形式式的指令来 ...
- APP分发渠道的竞争分析
一. 最近几年,手机APP市场发展非常迅速,随着手机的硬件水平的不断升级,大量资本涌入,越来越多的开发者从桌面平台开发转移到移动平台开发,面对数以万计的手机APP,如何推广自己的APP成了难题,APP ...
- nodejs总结
1.locomotive Powerful MVC web framework for Node.js. https://github.com/jaredhanson/locomotive 是基于ex ...
- 命令行启动win7系统操作部分功能
control.exe /name microsoft.folderoptions 启动资源管理器的 文件夹属性 选项卡 control.exe /name Microsoft.AddHardware ...
- node.js入门及express.js框架
node.js介绍 javascript原本只是用来处理前端,Node使得javascript编写服务端程序成为可能.于是前端开发者也可以借此轻松进入后端开发领域.Node是基于Google的V8引擎 ...
- python之urllib
简单的web应用包括使用被称为url(统一资源定位器,uniform resource locator)的web地址 这个地址用来在web上定位一个文档,或调用一个CGI程序来为你的客户端产生一个文档 ...
- HDU 2689Sort it 树状数组 逆序对
Sort it Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Sub ...