0
发现还是原生php操作数据库效率最高:
测试代码:
下载文件 (已下载 52 次)
原文地址:
Comparing ADODB with PEAR DB, MDB, dbx, Metabase and Native MySQL
20th October 2001 -- First version.
22nd October 2001 -- Code revised.
24th October 2001 -- PhpLib tests added.
5th February 2003 -- Test for dbx added.
6th February 2003 -- Test for MDB added.
8th March 2003 -- Test for adodb extension.
19th Sept 2003 -- Added benchmark 2
Benchmark 1
Benchmark was to select 82 rows from the products table 200 times.
The tests were repeated 5 times. Connection times were excluded
from the benchmark. Lower values are better. All numbers are in
seconds.
Benchmark 2
The first benchmark is a synthetic one that does not measure
live performance. This benchmark tries to be more realistic,
measuring HTTP requests/second. In this test, we select and
display 82 rows from the products table once per page request.
This is a round-trip benchmark using a HTTP benchmarking tool,
M'soft Web App Stress Tool (WAST). We measured with Turck MMCache
Accelerator 2.3.23 installed and without.
The tests were run as a variation of the above tests, e.g.
include_once('../benchdb/_adodb.inc.php');
$db =& Connect();
QueryOnce($db,1);
?>
Two runs were taken and averaged for each test. Higher values are
better. All measurements in pages/second.
With No
Accelerator Accelerator
MySQL 83.53 81.35
ADOdb 61.19 21.33
PEAR DB 52.85 25.26
This shows for best performance for any PHP software, you should
use an accelerator that pre-compiles your PHP code. The reason why
ADOdb benefits so much from an accelerator is that ADOdb is a
bigger library than PEAR DB.
Methodology
For benchmark 1, H/W is P800 Mhz, Win 2000, PHP 4.0.6 ISAPI on IIS5
with MySQL 3.23, all on the same machine. PEAR DB from PHP 4.0.6,
ADODB 1.40, PhpLib 7.2d and Metabase 1.57, dbx from PHP 4.3.0,
and MDB 1.1.1 were used.
For benchmark 2, H/W is P2.6Ghz, Win XP, PHP 4.3.3 Apache SAPI
with MySQL 4.1.12, all on the same machine. PEAR DB 1.13 (3/4/2003),
ADOdb 3.92 tested. M'soft WAST was the benchmarking tool, set
at 2 concurrent threads, 5 second warmup, 30 second benchmark.
Note the adodb extension test was done by replacing all calls to
$rs->MoveNext() with adodb_movenext($rs);
Source code for these tests is available from http://phplens.com/lens/adodb/
测试代码:
下载文件 (已下载 52 次)原文地址:
Comparing ADODB with PEAR DB, MDB, dbx, Metabase and Native MySQL
20th October 2001 -- First version.
22nd October 2001 -- Code revised.
24th October 2001 -- PhpLib tests added.
5th February 2003 -- Test for dbx added.
6th February 2003 -- Test for MDB added.
8th March 2003 -- Test for adodb extension.
19th Sept 2003 -- Added benchmark 2
Benchmark 1
Benchmark was to select 82 rows from the products table 200 times.
The tests were repeated 5 times. Connection times were excluded
from the benchmark. Lower values are better. All numbers are in
seconds.
引用
MySQL 1.12 1.12 1.17 1.15 1.14
ADOdbext 1.30 1.31 1.29 1.30 1.32
dbx ext 1.35 1.38 1.41 1.37 1.36 (index only)
ADOdb 1.43 1.47 1.47 1.44 1.45
dbx ext 1.53 1.52 1.52 1.52 1.55 (index/assoc/info)
PhpLib 1.53 1.62 1.64 1.64 1.57
MDB 1.77 1.75 1.75 1.76 1.73
PEAR DB 2.91 2.90 2.85 2.83 2.84 (fetchInto)
PEAR DB 3.14 3.13 3.22 3.12 3.16 (fetchRow)
M'base 4.51 4.55 4.46 4.54 4.52 (numeric indexes)
M'base 4.99 4.72 4.71 4.71 4.72 (assoc indexes)
ADOdbext 1.30 1.31 1.29 1.30 1.32
dbx ext 1.35 1.38 1.41 1.37 1.36 (index only)
ADOdb 1.43 1.47 1.47 1.44 1.45
dbx ext 1.53 1.52 1.52 1.52 1.55 (index/assoc/info)
PhpLib 1.53 1.62 1.64 1.64 1.57
MDB 1.77 1.75 1.75 1.76 1.73
PEAR DB 2.91 2.90 2.85 2.83 2.84 (fetchInto)
PEAR DB 3.14 3.13 3.22 3.12 3.16 (fetchRow)
M'base 4.51 4.55 4.46 4.54 4.52 (numeric indexes)
M'base 4.99 4.72 4.71 4.71 4.72 (assoc indexes)
引用
Average Overhead
MySQL 1.14 -
ADOdbext 1.30 14%
dbx 1.37 20% (index only)
ADOdb 1.45 27%
dbx 1.53 34% (index/assoc/info)
PhpLib 1.60 40%
MDB 1.75 54%
PEAR DB 2.87 152% (fetchInto)
PEAR DB 3.15 176% (fetchRow)
M'base 2.52 296% (numeric cols)
M'base 4.77 318% (assoc cols)
MySQL 1.14 -
ADOdbext 1.30 14%
dbx 1.37 20% (index only)
ADOdb 1.45 27%
dbx 1.53 34% (index/assoc/info)
PhpLib 1.60 40%
MDB 1.75 54%
PEAR DB 2.87 152% (fetchInto)
PEAR DB 3.15 176% (fetchRow)
M'base 2.52 296% (numeric cols)
M'base 4.77 318% (assoc cols)
Benchmark 2
The first benchmark is a synthetic one that does not measure
live performance. This benchmark tries to be more realistic,
measuring HTTP requests/second. In this test, we select and
display 82 rows from the products table once per page request.
This is a round-trip benchmark using a HTTP benchmarking tool,
M'soft Web App Stress Tool (WAST). We measured with Turck MMCache
Accelerator 2.3.23 installed and without.
The tests were run as a variation of the above tests, e.g.
include_once('../benchdb/_adodb.inc.php');
$db =& Connect();
QueryOnce($db,1);
?>
Two runs were taken and averaged for each test. Higher values are
better. All measurements in pages/second.
With No
Accelerator Accelerator
MySQL 83.53 81.35
ADOdb 61.19 21.33
PEAR DB 52.85 25.26
This shows for best performance for any PHP software, you should
use an accelerator that pre-compiles your PHP code. The reason why
ADOdb benefits so much from an accelerator is that ADOdb is a
bigger library than PEAR DB.
Methodology
For benchmark 1, H/W is P800 Mhz, Win 2000, PHP 4.0.6 ISAPI on IIS5
with MySQL 3.23, all on the same machine. PEAR DB from PHP 4.0.6,
ADODB 1.40, PhpLib 7.2d and Metabase 1.57, dbx from PHP 4.3.0,
and MDB 1.1.1 were used.
For benchmark 2, H/W is P2.6Ghz, Win XP, PHP 4.3.3 Apache SAPI
with MySQL 4.1.12, all on the same machine. PEAR DB 1.13 (3/4/2003),
ADOdb 3.92 tested. M'soft WAST was the benchmarking tool, set
at 2 concurrent threads, 5 second warmup, 30 second benchmark.
Note the adodb extension test was done by replacing all calls to
$rs->MoveNext() with adodb_movenext($rs);
Source code for these tests is available from http://phplens.com/lens/adodb/
Cache Performance Comparison
Using Memcache with MySQL and PHP


2008/06/22
20:19
1590



