项目组存在oracle跨库事物需求,考虑了两个方案,XA和DBLink。
对XA和DBLink性能方面的测试如下:(调研者:曹旭东)
1. 测试目标
力求发现XA和DBLink方式哪个更快
2. 观测数据
时间:执行插入操作所消耗的时间
系统:oracle在这两中情况下的性能报告
3. 测试方法
先用1k条数据对虚拟机进行预热,然后执行数据插入程序。
单一请求:
分别使用XA和DBLink,插入100k条数据,统计出插入100k条数据所需要的时间。在程序中添加计算时间的代码。
并发请求:
使用ab,模拟1000个并发,共请求100000次,统计出所需要的时间,ab可以给出统计报告。
4. 可能出现的偏差
(1) 使用DBLink方式,会将一部分计算操作转移到服务器上,而服务器的计算性能强于我本机的性能
(2) 测试过程中,我本机电脑运行的其他程序会对测试结果会产生影响
(3) 在对性能指标进行监控时,监控程序也会占用本机资源,影响结果
5. 测试结果
Tomcat启动参数
-Xloggc:E:\Temp\guzz\dbaccess.log -XX:+PrintGCDetails -XX:CompileThreshold=1 -server -Xmx512m -Xms512m
XA单一请求
测试开始时间 2012-02-03 12:11
测试结束时间 2012-02-03 15:13
程序运行时间 程序运行总共花费10797607毫秒,约2.9小时。
oracle情况
XA并发请求
测试开始时间 2012-02-03 15:19
测试结束时间 2012-02-03 16:14
程序运行时间 程序运行总共花费3281.928秒,约0.9小时
并发请求统计 参见ab的日志文件
oracle情况
DBLink单一请求
测试开始时间 2012-02-04 13:16
测试结束时间 2012-02-04 16:05
程序运行时间 程序运行总共花费9847839毫秒,约2.7小时
oracle情况
DBLink并发请求
测试开始时间 2012-02-03 17:08
测试结束时间 2012-02-03 18:24
程序运行时间 程序运行总共花费4566.270秒,约1.3小时
并发请求统计 参见ab的日志文件
oracle情况
6 结论
在对单一请求的重复测试中DBLink的性能好于XA,但需要考虑到DBLink方式将一部分计算交由DB服务器完成,
一方面DB服务器的性能强于我本机电脑,另一方面,它会增加DB服务器的负担。在并发状态下测试表明,XA的性能
强于DBLink,并且DBLink出现的错误多余XA。
ab-DBLinkConcurrent.log
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Server Software: Apache-Coyote/1.1
Server Hostname: localhost
Server Port: 8080
Document Path: /jifen/demo/dblinkCommit.action
Document Length: 11 bytes
Concurrency Level: 1000
Time taken for tests: 4566.270 seconds
Complete requests: 100000
Failed requests: 43654
(Connect: 0, Receive: 0, Length: 43654, Exceptions: 0)
Write errors: 0
Non-2xx responses: 43654
Total transferred: 591060690 bytes
HTML transferred: 577201838 bytes
Requests per second: 21.90 [#/sec] (mean)
Time per request: 45662.705 [ms] (mean)
Time per request: 45.663 [ms] (mean, across all concurrent requests)
Transfer rate: 126.41 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 4.6 0 484
Processing: 125 45506 18001.1 45011 109541
Waiting: 125 45498 17999.9 44996 109541
Total: 125 45507 18001.1 45011 109541
Percentage of the requests served within a certain time (ms)
50% 45011
66% 53405
75% 58320
80% 61097
90% 67509
95% 73735
98% 82019
99% 87901
100% 109541 (longest request)
ab-XAConcurrent.log
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking localhost (be patient)
Server Software: Apache-Coyote/1.1
Server Hostname: localhost
Server Port: 8080
Document Path: /jifen/demo/xaCommit.action?cn=123
Document Length: 11 bytes
Concurrency Level: 1000
Time taken for tests: 3281.928 seconds
Complete requests: 100000
Failed requests: 5307
(Connect: 0, Receive: 0, Length: 5307, Exceptions: 0)
Write errors: 0
Non-2xx responses: 5307
Total transferred: 83513135 bytes
HTML transferred: 71111469 bytes
Requests per second: 30.47 [#/sec] (mean)
Time per request: 32819.284 [ms] (mean)
Time per request: 32.819 [ms] (mean, across all concurrent requests)
Transfer rate: 24.85 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 5.0 0 625
Processing: 308 32716 13821.5 31547 100752
Waiting: 308 32707 13822.5 31533 100752
Total: 321 32717 13821.5 31548 100752
Percentage of the requests served within a certain time (ms)
50% 31548
66% 37140
75% 40966
80% 43277
90% 51055
95% 57912
98% 65314
99% 72686
100% 100752 (longest request)
XA和DBLink性能方面的测试
猜你喜欢
转载自mazhen2010.iteye.com/blog/1511847
今日推荐
周排行