DBA 数据库 db4 写入、查询测试

可以先看看这里的简介 DBA数据库 (这里没有提到db4,现在应该使用db4)

安装:

打开php.ini 确定 php_dba.dll 已经载入。

之后就可以使用dba函数库了。

这个数据,就是简单的 key=>value模式,和memcache差不多。

写入和查询速度都是非常快的。

如果是本机简单测试,可以使用 inifile 模式。

不过正式服务器上,一定要使用db4模式读写,因为其他模式比较慢,inifile就更慢了,还没有fopen快,所以inifile只能测试。

现在测试一下dba数据库的写入速度

每条数据是1k,写入速度分别是: 
10000条       1.71057009697
100000条      21.7869038582
1000000条    765.130697012

每条数据是2k,写入速度分别是: 
10000条       1.13584280014
100000条      25.066011906
1000000条     704.676019907

每条数据是3k,写入速度分别是: 
10000条       0.865121126175
100000条      24.7635490894
1000000条     745.992260933

每条数据是6k,写入速度分别是: 
10000条       4.17641997337
100000条      102.979793072
1000000条     1891.55883002

 可以看出,如果每条数据不超过3k的情况下,写入速度还是非常快的,而且大致都在一个范围内。(当然,这个速度还和服务器性能有关系)

 这是对测试结果做出的压力测试:

读取1000000数据的bdb库(3.9G左右),每次读取10-100条数据,每条数据的键,分别是1-1000000之间

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 si.adtest.com (be patient)
Server Software:        Apache/2.2.9
Server Hostname:        si.adtest.com
Server Port:            80

Document Path:          /test_bdb/r.php
Document Length:        37 bytes

Concurrency Level:      700
Time taken for tests:   2.558 seconds
Complete requests:      700
Failed requests:        555
   (Connect: 0, Receive: 0, Length: 555, Exceptions: 0)
Write errors:           0
Total transferred:      193705 bytes
HTML transferred:       26405 bytes
Requests per second:    273.62 [#/sec] (mean)
Time per request:       2558.262 [ms] (mean)
Time per request:       3.655 [ms] (mean, across all concurrent requests)
Transfer rate:          73.94 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    2   1.4      2       7
Processing:    82  471 118.6    517     559
Waiting:       26  443 118.9    484     544
Total:         82  473 119.2    519     559

Percentage of the requests served within a certain time (ms)
  50%    519
  66%    524
  75%    528
  80%    533
  90%    539
  95%    542
  98%    547
  99%    552
 100%    559 (longest request)

此条目发表在 数据库 分类目录。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用 * 标注

*

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>