This repository contains code to benchmark PHP connectors for Tarantool. Currently, there are two connectors available:
- tarantool/client written in pure PHP
- The official PECL extension
A more detailed explanation of the benchmarks represented in this repository can be found in this article.
- PHP 7.1+ (NTS and ZTS)
- Composer
- Tarantool 1.7.1+
- ext-msgpack to benchmark
Tarantool\Client\Packer\PeclPacker
- ext-async (fork) to benchmark connectors in async mode
- ext-parallel to benchmark connectors in parallel mode
- ext-swoole to benchmark connectors in async mode
- ext-tarantool to benchmark the official PHP connector
First, make sure you have the bench.lua instance running.
If you want to run it on Docker, execute:
docker run -d --network host --name=tarantool-bench \ -v $PWD/bench.lua:/bench.lua tarantool/tarantool:2 tarantool /bench.lua
Then run
make
to see the usage text and a list of all available benchmarks. For example, to (re)run all benchmarks, execute
make clean bench-all
Alternatively, you may run benchmarks on Docker using Docker Compose:
docker-compose run --rm benchmarks make clean bench-all
You may change default benchmark settings by defining the following environment variables (in parentheses are the default values):
TNT_BENCH_TARANTOOL_URI
(tcp://localhost:3301
)TNT_BENCH_TEMPLATE
(default.php.tpl
)TNT_BENCH_ITERATIONS
(5
)TNT_BENCH_REVOLUTIONS
(10000
)TNT_BENCH_RETRY_THRESHOLD
(3
)
For example:
make clean bench-all TNT_BENCH_REVOLUTIONS=20000 TNT_BENCH_RETRY_THRESHOLD=5
The below results were made by running benchmarks on Apple MacBook Pro (2015) on the following environment:
- Linux Fedora 30, kernel 5.3.8-200.fc30.x86_64
- Tarantool 2.3.0-115-g5ba5ed37e running on Docker
- Docker 19.03.3, build a872fc2f86
- PHP 7.3.11 (cli) (built: Oct 22 2019 08:11:04) ( NTS )
- PHP 7.3.11 (cli) (built: Oct 22 2019 08:11:04) ( ZTS )
- tarantool/client 0.6.0
- rybakit/msgpack 0.6.1
- ext-tarantool 0.3.2 with the patch
- ext-msgpack 2.0.3
- ext-async 0.3.0-8c1da46
- ext-swoole 4.4.12
- ext-parallel 1.1.3
The library is released under the MIT License. See the bundled LICENSE file for details.