SlideShare una empresa de Scribd logo
1 de 17
ORACLE 性能优化
童家旺
微博:jametong
博客:dbthink.com
大纲
 优化是什么?
 Latency & Throughput
 Performance & Scalability
 数据库的Tuning By Layers
 常见案例分析
 参考资料
优化是什么?
 The fastest way to do something is don‘t do it
 Anonymous
 Two ways to improve performance, do it less or do it
faster
 Anonymous
 Performance is all about code path
 From Cary Millsap
 http://carymillsap.blogspot.com/2010/09/my-otn-interview-at-oow2010-which-
hasnt.html
优化是什么?
 不访问不必要的数据
 合理的利用硬件来提升访问效率
 使用缓存消除对数据的重复访问
 使用批量处理来减少交互次数(磁盘、网络)
 使用新硬件来降低后端的延时,提高效率
 提高系统的吞吐量
 对工作单元进行细化,减少串行操作
 合理的拆分(水平、垂直拆分)以提高系统的整体吞吐能力
响应时间 Vs 吞吐量
Performance & Scalability
 系统是否足够快?
 只有一个用户时足够
快吗?
 那么系统有扩展性问
题,而不是性能问题?
 排队论可以解释高负
载情况下的性能问题。
Tuning By Layers(逐层优化)
 Design Layer
 Application Layer
 请求次数、网络交互
 Database Code Layer
 SQL Parse、SQL Tuning、Locks、Concurrency
 Memory Layer
 Buffer Cache、PGA、Shared Pool
 Disk Layer
 不同的硬件设备
合理设计表结构
 动静分离
 冷热分离
 大字段分离
 重要程度分离
 合理选择范式化
业务层缓存优化
 使用场景
 缓存的一致性维护问题
 数据的具体读写比
 变更频率
 业务对一致性的要求
 使用何种缓存方式.
 注意事项
 考虑缓存的刷新策略
 考虑缓存的数据延迟对业务的影响
 考虑缓存失效时,系统的支撑能力
 参考缓存工具: MemCached, Tair, Redis
 Oracle自身的Server Result Cache、Client Result Cache、Mview
批量处理
 使用匿名块包装多次SQL
 批量数据处理(Array Fetch、Array Insert)
0
5
10
15
2
4
8
12
16
20
24
28
32
36
40
50
60
100
150
200
400
800
1600
3200
5000
elapsed time
使用绑定变量
0
10000
20000
30000
40000
50000
60000
70000
80000
90000
0 1 2 3 4 5 6 7
Parse Once Execute Many Session Cache Cursor
Bind Variable No Bind Variable
索引优化
优化系统争用
减少Contention
 Index Concurrency
 高插入频率的单调递增索引
 Row Concurrency
 高更新次数的记录
 Buffer Contention
 队列表的处理
 Mutex Contention
 高执行次数的SQL
LGWR的优化
硬件优化
 使用BBU或Shared Storage优化日志写
 使用Flash优化数据文件读写
 使用IB优化RAC的InterConnect
 使用高频CPU以及超频技术提高CPU能力
Recommended Reading
 Optimizing Oracle Performance
 By Cary Millsap, Jeff Holt
 Forecasting Oracle Performance
 By Craig Shallahamer
 Guerrilla Capacity Planning
 By Neil J. Gunther
 Relational Database Index Design and the Optimizers
 By Tapio Lahdenmaki
 Think Clearly About Performance
 By Cary Millsap
 http://www.method-r.com/downloads/doc_details/44-thinking-clearly-about-performance
 TroubleShooting Oracle Performance
 By Christian Antognini
 Oracle性能优化生存指南
 Translated By 郑勇斌/胡怡文/童家旺
 性能诊断艺术
 Translated By 冯大辉/胡怡文/童家旺

Más contenido relacionado

Similar a Oracle 性能优化

Performance Data Analyze
Performance Data AnalyzePerformance Data Analyze
Performance Data Analyzeanysql
 
腾讯大讲堂19 系统优化的方向
腾讯大讲堂19 系统优化的方向腾讯大讲堂19 系统优化的方向
腾讯大讲堂19 系统优化的方向topgeek
 
腾讯大讲堂19 系统优化的方向
腾讯大讲堂19 系统优化的方向腾讯大讲堂19 系统优化的方向
腾讯大讲堂19 系统优化的方向areyouok
 
Oracle db 12c 加速企业转型之十大功能
Oracle db 12c 加速企业转型之十大功能Oracle db 12c 加速企业转型之十大功能
Oracle db 12c 加速企业转型之十大功能Ethan M. Liu
 
Sybase Analytic Appliance
Sybase Analytic ApplianceSybase Analytic Appliance
Sybase Analytic Appliancefocusbi
 
Oracle 高可用概述
Oracle 高可用概述Oracle 高可用概述
Oracle 高可用概述xlight
 
Oracle ha
Oracle haOracle ha
Oracle haxlight
 
王龙:百度数据库架构演变与设计
王龙:百度数据库架构演变与设计王龙:百度数据库架构演变与设计
王龙:百度数据库架构演变与设计YANGL *
 
Alibaba数据库运维最佳实践
Alibaba数据库运维最佳实践Alibaba数据库运维最佳实践
Alibaba数据库运维最佳实践freezr
 
易思捷云操作系统概述
易思捷云操作系统概述易思捷云操作系统概述
易思捷云操作系统概述炳富 杨
 
数据库性能诊断的七种武器
数据库性能诊断的七种武器数据库性能诊断的七种武器
数据库性能诊断的七种武器Leyi (Kamus) Zhang
 
Oracle数据库体系结构简介.ppt
Oracle数据库体系结构简介.pptOracle数据库体系结构简介.ppt
Oracle数据库体系结构简介.pptjames tong
 
Top100summit ibm-董国兴-系统架构优化与技术规划
Top100summit ibm-董国兴-系统架构优化与技术规划 Top100summit ibm-董国兴-系统架构优化与技术规划
Top100summit ibm-董国兴-系统架构优化与技术规划 drewz lin
 
阿里云 张旭 集群运维管理平台
阿里云 张旭 集群运维管理平台阿里云 张旭 集群运维管理平台
阿里云 张旭 集群运维管理平台guiyingshenxia
 
集群运维管理平台
集群运维管理平台集群运维管理平台
集群运维管理平台mysqlops
 
性能测试实践1
性能测试实践1性能测试实践1
性能测试实践1yiditushe
 
I Sample 20070904
I Sample 20070904I Sample 20070904
I Sample 20070904Shin-Jan Wu
 
海量统计数据的分布式MySQL集群——MyFOX
海量统计数据的分布式MySQL集群——MyFOX海量统计数据的分布式MySQL集群——MyFOX
海量统计数据的分布式MySQL集群——MyFOXaleafs
 
Actuate presentation 2011
Actuate presentation   2011Actuate presentation   2011
Actuate presentation 2011Luke Han
 

Similar a Oracle 性能优化 (20)

Performance Data Analyze
Performance Data AnalyzePerformance Data Analyze
Performance Data Analyze
 
腾讯大讲堂19 系统优化的方向
腾讯大讲堂19 系统优化的方向腾讯大讲堂19 系统优化的方向
腾讯大讲堂19 系统优化的方向
 
腾讯大讲堂19 系统优化的方向
腾讯大讲堂19 系统优化的方向腾讯大讲堂19 系统优化的方向
腾讯大讲堂19 系统优化的方向
 
Oracle db 12c 加速企业转型之十大功能
Oracle db 12c 加速企业转型之十大功能Oracle db 12c 加速企业转型之十大功能
Oracle db 12c 加速企业转型之十大功能
 
Sybase Analytic Appliance
Sybase Analytic ApplianceSybase Analytic Appliance
Sybase Analytic Appliance
 
Oracle 高可用概述
Oracle 高可用概述Oracle 高可用概述
Oracle 高可用概述
 
Oracle ha
Oracle haOracle ha
Oracle ha
 
王龙:百度数据库架构演变与设计
王龙:百度数据库架构演变与设计王龙:百度数据库架构演变与设计
王龙:百度数据库架构演变与设计
 
Java@taobao
Java@taobaoJava@taobao
Java@taobao
 
Alibaba数据库运维最佳实践
Alibaba数据库运维最佳实践Alibaba数据库运维最佳实践
Alibaba数据库运维最佳实践
 
易思捷云操作系统概述
易思捷云操作系统概述易思捷云操作系统概述
易思捷云操作系统概述
 
数据库性能诊断的七种武器
数据库性能诊断的七种武器数据库性能诊断的七种武器
数据库性能诊断的七种武器
 
Oracle数据库体系结构简介.ppt
Oracle数据库体系结构简介.pptOracle数据库体系结构简介.ppt
Oracle数据库体系结构简介.ppt
 
Top100summit ibm-董国兴-系统架构优化与技术规划
Top100summit ibm-董国兴-系统架构优化与技术规划 Top100summit ibm-董国兴-系统架构优化与技术规划
Top100summit ibm-董国兴-系统架构优化与技术规划
 
阿里云 张旭 集群运维管理平台
阿里云 张旭 集群运维管理平台阿里云 张旭 集群运维管理平台
阿里云 张旭 集群运维管理平台
 
集群运维管理平台
集群运维管理平台集群运维管理平台
集群运维管理平台
 
性能测试实践1
性能测试实践1性能测试实践1
性能测试实践1
 
I Sample 20070904
I Sample 20070904I Sample 20070904
I Sample 20070904
 
海量统计数据的分布式MySQL集群——MyFOX
海量统计数据的分布式MySQL集群——MyFOX海量统计数据的分布式MySQL集群——MyFOX
海量统计数据的分布式MySQL集群——MyFOX
 
Actuate presentation 2011
Actuate presentation   2011Actuate presentation   2011
Actuate presentation 2011
 

Más de james tong

数据库系统设计漫谈
数据库系统设计漫谈数据库系统设计漫谈
数据库系统设计漫谈james tong
 
Migrating from MySQL to PostgreSQL
Migrating from MySQL to PostgreSQLMigrating from MySQL to PostgreSQL
Migrating from MySQL to PostgreSQLjames tong
 
Cap 理论与实践
Cap 理论与实践Cap 理论与实践
Cap 理论与实践james tong
 
Scalable system operations presentation
Scalable system operations presentationScalable system operations presentation
Scalable system operations presentationjames tong
 
Benchmarks, performance, scalability, and capacity what s behind the numbers...
Benchmarks, performance, scalability, and capacity  what s behind the numbers...Benchmarks, performance, scalability, and capacity  what s behind the numbers...
Benchmarks, performance, scalability, and capacity what s behind the numbers...james tong
 
Stability patterns presentation
Stability patterns presentationStability patterns presentation
Stability patterns presentationjames tong
 
The right read optimization is actually write optimization
The right read optimization is actually write optimizationThe right read optimization is actually write optimization
The right read optimization is actually write optimizationjames tong
 
My sql ssd-mysqluc-2012
My sql ssd-mysqluc-2012My sql ssd-mysqluc-2012
My sql ssd-mysqluc-2012james tong
 
Evaluating ha alternatives my sql tutorial2
Evaluating ha alternatives my sql tutorial2Evaluating ha alternatives my sql tutorial2
Evaluating ha alternatives my sql tutorial2james tong
 
Troubleshooting mysql-tutorial
Troubleshooting mysql-tutorialTroubleshooting mysql-tutorial
Troubleshooting mysql-tutorialjames tong
 
Understanding performance through_measurement
Understanding performance through_measurementUnderstanding performance through_measurement
Understanding performance through_measurementjames tong
 
我对后端优化的一点想法 (2012)
我对后端优化的一点想法 (2012)我对后端优化的一点想法 (2012)
我对后端优化的一点想法 (2012)james tong
 
设计可扩展的Oracle应用
设计可扩展的Oracle应用设计可扩展的Oracle应用
设计可扩展的Oracle应用james tong
 
我对后端优化的一点想法.pptx
我对后端优化的一点想法.pptx我对后端优化的一点想法.pptx
我对后端优化的一点想法.pptxjames tong
 
Enqueue Lock介绍.ppt
Enqueue Lock介绍.pptEnqueue Lock介绍.ppt
Enqueue Lock介绍.pptjames tong
 
Cassandra简介.ppt
Cassandra简介.pptCassandra简介.ppt
Cassandra简介.pptjames tong
 

Más de james tong (16)

数据库系统设计漫谈
数据库系统设计漫谈数据库系统设计漫谈
数据库系统设计漫谈
 
Migrating from MySQL to PostgreSQL
Migrating from MySQL to PostgreSQLMigrating from MySQL to PostgreSQL
Migrating from MySQL to PostgreSQL
 
Cap 理论与实践
Cap 理论与实践Cap 理论与实践
Cap 理论与实践
 
Scalable system operations presentation
Scalable system operations presentationScalable system operations presentation
Scalable system operations presentation
 
Benchmarks, performance, scalability, and capacity what s behind the numbers...
Benchmarks, performance, scalability, and capacity  what s behind the numbers...Benchmarks, performance, scalability, and capacity  what s behind the numbers...
Benchmarks, performance, scalability, and capacity what s behind the numbers...
 
Stability patterns presentation
Stability patterns presentationStability patterns presentation
Stability patterns presentation
 
The right read optimization is actually write optimization
The right read optimization is actually write optimizationThe right read optimization is actually write optimization
The right read optimization is actually write optimization
 
My sql ssd-mysqluc-2012
My sql ssd-mysqluc-2012My sql ssd-mysqluc-2012
My sql ssd-mysqluc-2012
 
Evaluating ha alternatives my sql tutorial2
Evaluating ha alternatives my sql tutorial2Evaluating ha alternatives my sql tutorial2
Evaluating ha alternatives my sql tutorial2
 
Troubleshooting mysql-tutorial
Troubleshooting mysql-tutorialTroubleshooting mysql-tutorial
Troubleshooting mysql-tutorial
 
Understanding performance through_measurement
Understanding performance through_measurementUnderstanding performance through_measurement
Understanding performance through_measurement
 
我对后端优化的一点想法 (2012)
我对后端优化的一点想法 (2012)我对后端优化的一点想法 (2012)
我对后端优化的一点想法 (2012)
 
设计可扩展的Oracle应用
设计可扩展的Oracle应用设计可扩展的Oracle应用
设计可扩展的Oracle应用
 
我对后端优化的一点想法.pptx
我对后端优化的一点想法.pptx我对后端优化的一点想法.pptx
我对后端优化的一点想法.pptx
 
Enqueue Lock介绍.ppt
Enqueue Lock介绍.pptEnqueue Lock介绍.ppt
Enqueue Lock介绍.ppt
 
Cassandra简介.ppt
Cassandra简介.pptCassandra简介.ppt
Cassandra简介.ppt
 

Oracle 性能优化