lsmith / phpcr_benchmark
PHPCR 性能基准
dev-master
2014-08-18 09:04 UTC
Requires
- phpcr/phpcr-implementation: ~2.1
- psr/log: ~1.0
- symfony/stopwatch: ~2.4
This package is not auto-updated.
Last update: 2024-09-10 01:31:59 UTC
README
本仓库的目的是比较不同的PHPCR实现。
创建数据库是必要的,并确保在使用Doctrine DBAL时初始化数据库结构。
composer require jackalope/jackalope-doctrine-dbal:~1.1
./vendor/bin/jackalope jackalope:init:dbal
或者,当使用Jackrabbit时,下载并启动服务器。
composer require jackalope/jackalope-jackrabbit:~1.1
./vendor/bin/jackrabbit.sh
此外,您还可以使用MongoDB(目前不可用)。
composer require jackalope/jackalope-mongodb:dev-master
将 cli-config.php.dist
复制到 cli-config.php
并根据需要调整。最后运行 php index.php
或 php index.php benchmark
。
您也可以通过 --count
配置每批添加的节点数,以及通过 --sections
配置重复次数。
例如:php index.php benchmark --count 4 --sections 7
(请注意,不支持等号)
一旦运行过一次命令,可以选择再次运行 php index.php benchmark --append
以在现有数据之上添加一个“部分”,以查看在没有大量先前插入/获取的情况下性能如何。当然,这可以与其他参数结合使用。
此外,您可以在测试运行之前通过 --optimize
强制执行表优化(对于Doctrine DBAL),并通过 --disable-query
禁用查询执行。
最后,您可以通过 ./vendor/bin/jackalope
运行一些标准的Jackalope命令。
待办事项
- 使存储的节点更复杂一些
- 调查缓慢(尤其是插入性能,为什么SQLite在子路径查询中不使用索引,以及通过路径获取的缓慢)
结果
Jackalope Doctrine DBAL MySQL
lsmith@localhost phpcr_benchmark (master)$ php index.php benchmark --count 100 --sections 100
Inserting 100 nodes (total 100) took '279' ms.
Getting a node by path took '1' ms.
Searching a node by property took '14' ms.
Searching a node by property in a subpath took '5' ms.
Inserting 100 nodes (total 200) took '580' ms.
Getting a node by path took '2' ms.
Searching a node by property took '30' ms.
Searching a node by property in a subpath took '11' ms.
Inserting 100 nodes (total 300) took '871' ms.
Getting a node by path took '3' ms.
Searching a node by property took '42' ms.
Searching a node by property in a subpath took '18' ms.
Inserting 100 nodes (total 400) took '1188' ms.
Getting a node by path took '4' ms.
Searching a node by property took '56' ms.
Searching a node by property in a subpath took '26' ms.
Inserting 100 nodes (total 500) took '1503' ms.
Getting a node by path took '5' ms.
Searching a node by property took '72' ms.
Searching a node by property in a subpath took '33' ms.
Inserting 100 nodes (total 600) took '1824' ms.
Getting a node by path took '6' ms.
Searching a node by property took '86' ms.
Searching a node by property in a subpath took '38' ms.
Inserting 100 nodes (total 700) took '2147' ms.
Getting a node by path took '7' ms.
Searching a node by property took '101' ms.
Searching a node by property in a subpath took '45' ms.
Inserting 100 nodes (total 800) took '2753' ms.
Getting a node by path took '8' ms.
Searching a node by property took '117' ms.
Searching a node by property in a subpath took '50' ms.
Inserting 100 nodes (total 900) took '3057' ms.
Getting a node by path took '9' ms.
Searching a node by property took '135' ms.
Searching a node by property in a subpath took '55' ms.
...
Inserting 100 nodes (total 10000) took '31670' ms.
Getting a node by path took '130' ms.
Searching a node by property took '4955' ms.
Searching a node by property in a subpath took '551' ms.
lsmith@localhost phpcr_benchmark (master)$ php index.php benchmark --count 100 --sections 100 --append
Inserting 100 nodes (total 10100) took '303' ms.
Getting a node by path took '1' ms.
Searching a node by property took '113' ms.
Searching a node by property in a subpath took '6' ms.
Jackalope Doctrine DBAL SQLite
lsmith@localhost phpcr_benchmark (master)$ php index.php benchmark --count 100 --sections 100
Inserting 100 nodes (total 100) took '131' ms.
Getting a node by path took '1' ms.
Searching a node by property took '22' ms.
Searching a node by property in a subpath took '11' ms.
Inserting 100 nodes (total 200) took '262' ms.
Getting a node by path took '2' ms.
Searching a node by property took '47' ms.
Searching a node by property in a subpath took '28' ms.
Inserting 100 nodes (total 300) took '393' ms.
Getting a node by path took '3' ms.
Searching a node by property took '77' ms.
Searching a node by property in a subpath took '59' ms.
Inserting 100 nodes (total 400) took '521' ms.
Getting a node by path took '3' ms.
Searching a node by property took '117' ms.
Searching a node by property in a subpath took '94' ms.
Inserting 100 nodes (total 500) took '652' ms.
Getting a node by path took '3' ms.
Searching a node by property took '175' ms.
Searching a node by property in a subpath took '133' ms.
Inserting 100 nodes (total 600) took '787' ms.
Getting a node by path took '3' ms.
Searching a node by property took '226' ms.
Searching a node by property in a subpath took '180' ms.
Inserting 100 nodes (total 700) took '921' ms.
Getting a node by path took '4' ms.
Searching a node by property took '295' ms.
Searching a node by property in a subpath took '231' ms.
Inserting 100 nodes (total 800) took '1055' ms.
Getting a node by path took '5' ms.
Searching a node by property took '359' ms.
Searching a node by property in a subpath took '291' ms.
Inserting 100 nodes (total 900) took '1190' ms.
Getting a node by path took '6' ms.
Searching a node by property took '437' ms.
Searching a node by property in a subpath took '357' ms.
...
Inserting 100 nodes (total 10000) took '14616' ms.
Getting a node by path took '98' ms.
Searching a node by property took '40642' ms.
Searching a node by property in a subpath took '39664' ms.
lsmith@localhost phpcr_benchmark (master)$ php index.php benchmark --count 100 --sections 100 --append
Inserting 100 nodes (total 10100) took '140' ms.
Getting a node by path took '0' ms.
Searching a node by property took '763' ms.
Searching a node by property in a subpath took '735' ms.
Jackalope Jackrabbit 2.x
lsmith@localhost phpcr_benchmark (master)$ php index.php benchmark --count 100 --sections 100
Inserting 100 nodes (total 100) took '103' ms.
Getting a node by path took '2' ms.
Searching a node by property took '7' ms.
Searching a node by property in a subpath took '4' ms.
Inserting 100 nodes (total 200) took '223' ms.
Getting a node by path took '4' ms.
Searching a node by property took '22' ms.
Searching a node by property in a subpath took '10' ms.
Inserting 100 nodes (total 300) took '335' ms.
Getting a node by path took '7' ms.
Searching a node by property took '38' ms.
Searching a node by property in a subpath took '17' ms.
Inserting 100 nodes (total 400) took '459' ms.
Getting a node by path took '9' ms.
Searching a node by property took '48' ms.
Searching a node by property in a subpath took '22' ms.
Inserting 100 nodes (total 500) took '591' ms.
Getting a node by path took '11' ms.
Searching a node by property took '63' ms.
Searching a node by property in a subpath took '27' ms.
Inserting 100 nodes (total 600) took '699' ms.
Getting a node by path took '13' ms.
Searching a node by property took '78' ms.
Searching a node by property in a subpath took '34' ms.
Inserting 100 nodes (total 700) took '842' ms.
Getting a node by path took '16' ms.
Searching a node by property took '92' ms.
Searching a node by property in a subpath took '40' ms.
Inserting 100 nodes (total 800) took '947' ms.
Getting a node by path took '18' ms.
Searching a node by property took '106' ms.
Searching a node by property in a subpath took '46' ms.
Inserting 100 nodes (total 900) took '1053' ms.
Getting a node by path took '20' ms.
Searching a node by property took '120' ms.
Searching a node by property in a subpath took '55' ms.
...
Inserting 100 nodes (total 10000) took '7642' ms.
Getting a node by path took '199' ms.
Searching a node by property took '1506' ms.
Searching a node by property in a subpath took '492' ms.
lsmith@localhost phpcr_benchmark (master)$ php index.php benchmark --count 100 --sections 100 --append
Inserting 100 nodes (total 10100) took '68' ms.
Getting a node by path took '2' ms.
Searching a node by property took '21' ms.
Searching a node by property in a subpath took '16' ms.
Jackalope MongoDB
进行中