LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 9041|回复: 6

评测下ADODB,ADODB_Lite,PDO和MDB2

[复制链接]
发表于 2005-8-2 13:11:27 | 显示全部楼层 |阅读模式
测试环境:
硬件:赛扬2.66G,512M DDR

软件:Windows2003,Mysql-4.1.13,apache2.0.54,php5.1.0beta3(内置PDO,哈哈)
用ab做1000个连接,50个并发,不是很多,呵呵

ADODB:不是我说,最慢的果然是它


没有使用cache:
D:\server\Apache2\bin>ab -k -n 1000 -c 50 -k http://127.0.0.1/adotest.php
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


Server Software:        Apache
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /adotest.php
Document Length:        0 bytes

Concurrency Level:      50
Time taken for tests:   72.593750 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    991
Total transferred:      220596 bytes
HTML transferred:       0 bytes
Requests per second:    13.78 [#/sec] (mean)
Time per request:       3629.688 [ms] (mean)
Time per request:       72.594 [ms] (mean, across all concurrent requests)
Transfer rate:          2.96 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   1.0      0      31
Processing:    62  449 3823.1     78   66125
Waiting:       62  448 3823.1     78   66125
Total:         62  449 3823.4     78   66125

Percentage of the requests served within a certain time (ms)
  50%     78
  66%    234
  75%    281
  80%    296
  90%    328
  95%    375
  98%    421
  99%    468
100%  66125 (longest request)



使用了cache:
D:\server\Apache2\bin>ab -k -n 1000 -c 50 -k http://127.0.0.1/adotest.php
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


Server Software:        Apache
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /adotest.php
Document Length:        0 bytes

Concurrency Level:      50
Time taken for tests:   70.265625 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    991
Total transferred:      220596 bytes
HTML transferred:       0 bytes
Requests per second:    14.23 [#/sec] (mean)
Time per request:       3513.281 [ms] (mean)
Time per request:       70.266 [ms] (mean, across all concurrent requests)
Transfer rate:          3.06 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   1.0      0      31
Processing:    62  413 3760.9     78   63968
Waiting:       62  413 3760.9     78   63968
Total:         62  413 3761.3     78   63968

Percentage of the requests served within a certain time (ms)
  50%     78
  66%     78
  75%    187
  80%    203
  90%    234
  95%    250
  98%    281
  99%    343
100%  63968 (longest request)[/HTML]



MDB2,Pear的class,和ADODB功能相近
[HTML]D:\server\Apache2\bin>ab -k -n 1000 -c 50 -k http://127.0.0.1/mdb2test.php
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


Server Software:        Apache
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /mdb2test.php
Document Length:        0 bytes

Concurrency Level:      50
Time taken for tests:   53.484375 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    991
Total transferred:      220596 bytes
HTML transferred:       0 bytes
Requests per second:    18.70 [#/sec] (mean)
Time per request:       2674.219 [ms] (mean)
Time per request:       53.484 [ms] (mean, across all concurrent requests)
Transfer rate:          4.02 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.5      0      15
Processing:    46  326 2796.3     62   48609
Waiting:       15  326 2796.3     62   48609
Total:         46  326 2796.5     62   48609

Percentage of the requests served within a certain time (ms)
  50%     62
  66%    171
  75%    203
  80%    218
  90%    250
  95%    265
  98%    296
  99%    343
100%  48609 (longest request)
 楼主| 发表于 2005-8-2 13:13:00 | 显示全部楼层
接下来是ADODB_lite,号称比ado小n多,测试结果也让人满意
D:\server\Apache2\bin>ab -k -n 1000 -c 50 -k http://127.0.0.1/adolitetest.php
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


Server Software:        Apache
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /adolitetest.php
Document Length:        0 bytes

Concurrency Level:      50
Time taken for tests:   25.62500 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    991
Total transferred:      220596 bytes
HTML transferred:       0 bytes
Requests per second:    39.90 [#/sec] (mean)
Time per request:       1253.125 [ms] (mean)
Time per request:       25.063 [ms] (mean, across all concurrent requests)
Transfer rate:          8.58 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.5      0      15
Processing:    15  152 1310.7     31   22781
Waiting:       15  152 1310.7     31   22781
Total:         15  152 1310.8     31   22781

Percentage of the requests served within a certain time (ms)
  50%     31
  66%     78
  75%     93
  80%     93
  90%    125
  95%    125
  98%    156
  99%    156
100%  22781 (longest request)
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-8-2 13:14:28 | 显示全部楼层
但是看了PDO就知道什么是速度了
D:\server\Apache2\bin>ab -k -n 1000 -c 50 -k http://127.0.0.1/pdotest.php
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


Server Software:        Apache
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /pdotest.php
Document Length:        0 bytes

Concurrency Level:      50
Time taken for tests:   17.46875 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    991
Total transferred:      220596 bytes
HTML transferred:       0 bytes
Requests per second:    58.66 [#/sec] (mean)
Time per request:       852.344 [ms] (mean)
Time per request:       17.047 [ms] (mean, across all concurrent requests)
Transfer rate:          12.61 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.5      0      15
Processing:    15  103 886.9     15   15453
Waiting:       15  103 886.9     15   15453
Total:         15  103 887.1     15   15453

Percentage of the requests served within a certain time (ms)
  50%     15
  66%     46
  75%     62
  80%     62
  90%     78
  95%     93
  98%    109
  99%    125
100%  15453 (longest request)
回复 支持 反对

使用道具 举报

 楼主| 发表于 2005-8-2 13:20:01 | 显示全部楼层
最后这个是标准的mysql函数库
D:\server\Apache2\bin>ab -k -n 1000 -c 50 -k http://127.0.0.1/mysqltest.php
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.121.2.12 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


Server Software:        Apache
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /mysqltest.php
Document Length:        0 bytes

Concurrency Level:      50
Time taken for tests:   17.265625 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    991
Total transferred:      220596 bytes
HTML transferred:       0 bytes
Requests per second:    57.92 [#/sec] (mean)
Time per request:       863.281 [ms] (mean)
Time per request:       17.266 [ms] (mean, across all concurrent requests)
Transfer rate:          12.45 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:    15  105 904.5     15   15718
Waiting:       15  105 904.5     15   15718
Total:         15  105 904.5     15   15718

Percentage of the requests served within a certain time (ms)
  50%     15
  66%     46
  75%     62
  80%     62
  90%     78
  95%     93
  98%    109
  99%    125
100%  15718 (longest request)
回复 支持 反对

使用道具 举报

发表于 2005-8-2 15:11:35 | 显示全部楼层
nbx加内存了,祝贺祝贺!
测试结果和我差不多。可见ADODB之慢。
不过用PDO必直接使用函数联结快有点不太正常。我测试结果应该稍慢一点的。毕竟是作为通用接口开发的,速度比直接函数联结快有点问题。估计NBX的直接函数联结使用了自己的类,造成结果偏差。
另外为了大家对联结的类有一个直观感受,贴一下adodb和pear::db联结的测试情况:
adodb:
[php]
myhome:/usr/share/php# ab -n 1000 -c 100 http://127.0.0.1/apache2-default/xsgl/dblink/mylink.php
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


Server Software:        Apache/2.0.54
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /apache2-default/xsgl/dblink/mylink.php
Document Length:        14 bytes

Concurrency Level:      100
Time taken for tests:   90.761502 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      467000 bytes
HTML transferred:       14000 bytes
Requests per second:    11.02 [#/sec] (mean)
Time per request:       9076.151 [ms] (mean)
Time per request:       90.762 [ms] (mean, across all concurrent requests)
Transfer rate:          5.02 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    3   9.6      0     129
Processing:   883 8630 1325.8   8764   12895
Waiting:      872 8629 1326.6   8764   12894
Total:        925 8633 1319.8   8764   12895

Percentage of the requests served within a certain time (ms)
  50%   8764
  66%   8811
  75%   8843
  80%   8896
  90%   9380
  95%   9645
  98%  10049
  99%  11974
100%  12895 (longest request)
[/php]
pear::db
[php]
myhome:/usr/share/php# ab -n 1000 -c 100 http://127.0.0.1/apache2-default/xsgl/dblink/peardb.php
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests


Server Software:        Apache/2.0.54
Server Hostname:        127.0.0.1
Server Port:            80

Document Path:          /apache2-default/xsgl/dblink/peardb.php
Document Length:        78 bytes

Concurrency Level:      100
Time taken for tests:   60.577066 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      330000 bytes
HTML transferred:       78000 bytes
Requests per second:    16.51 [#/sec] (mean)
Time per request:       6057.706 [ms] (mean)
Time per request:       60.577 [ms] (mean, across all concurrent requests)
Transfer rate:          5.32 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2   6.0      0      31
Processing:   633 5759 931.2   5876    8594
Waiting:      631 5758 931.2   5875    8593
Total:        662 5761 926.8   5876    8611

Percentage of the requests served within a certain time (ms)
  50%   5876
  66%   5912
  75%   5936
  80%   5944
  90%   6403
  95%   6485
  98%   7004
  99%   7199
100%   8611 (longest request)
[/php]
回复 支持 反对

使用道具 举报

发表于 2006-5-2 01:16:48 | 显示全部楼层
ding,ding,ding,ding,
回复 支持 反对

使用道具 举报

发表于 2006-5-14 04:07:33 | 显示全部楼层
虽然PEAR::MDB2已经出来很久了,我的框架还在用PEAR:B。这几天下决心升级,用PDO做数据库部分~~呵呵,比较郁闷~~transaction功能用不了~
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表