Home

Awesome

PHP Framework Benchmark

This project attempts to measure minimum overhead (minimum bootstrap cost) of PHP frameworks in the real world.

So I think the minimum applications to benchmark should not include:

Components like Template engine or ORM/Database libraries are out of scope in this project.

Benchmarking Policy

This is master branch.

Some people may think using default configuration is not fair. But I think a framework's default configuration is an assertion of what it is. Default configuration is a good starting point to know a framework. And I can't optimize all the frameworks. Some frameworks are optimized, some are not, it is not fair. So I don't remove any components/configurations.

But if you are interested in benchmarking with optimization (removing components/configurations which are not used), See optimize branch.

If you find something wrong with my code, please feel free to send Pull Requests. But please note optimizing only for "Hello World" is not acceptable. Building fastest "Hello World" application is not the goal in this project.

Results

Benchmarking Environment

Hello World Benchmark

These are my benchmarks, not yours. I encourage you to run on your (production equivalent) environments.

(2017/02/14)

Benchmark Results Graph

frameworkrequests per secondrelativepeak memoryrelative
siler-0.62,069.6920.30.251.0
kumbia-1.0-dev1,753.6017.20.291.2
staticphp-0.91,665.2816.30.271.1
phalcon-2.01,618.3915.90.261.1
tipsy-0.101,376.9713.50.321.3
fatfree-3.5965.169.50.411.7
ci-3.0753.097.40.421.7
nofuss-1.2667.246.50.401.6
slim-3.0550.435.40.612.5
bear-1.0502.524.90.733.0
lumen-5.1415.574.10.853.5
yii-2.0410.084.01.325.4
ze-1.0403.344.00.753.1
cygnite-1.3369.123.60.712.9
fuel-1.8344.263.40.632.6
silex-2.0342.813.40.783.2
phpixie-3.2267.242.61.255.1
aura-2.0233.542.30.883.6
cake-3.2174.911.71.957.9
zf-3.0133.871.32.249.1
symfony-3.0131.501.32.188.9
laravel-5.3101.941.02.8311.5

Note(1): All the results are run on php with phalcon.so and ice.so. If you don't load phalcon.so or ice.so, the rps except for Phalcon or Ice probably increase a bit.

Note(2): This benchmarks are limited by ab performance. See #62.

How to Benchmark

If you want to benchmark PHP extension frameworks like Phalcon, you need to install the extenstions.

Install source code as http://localhost/php-framework-benchmark/:

$ git clone https://github.com/kenjis/php-framework-benchmark.git
$ cd php-framework-benchmark
$ bash setup.sh

Run benchmarks:

$ bash benchmark.sh

See http://localhost/php-framework-benchmark/.

If you want to benchmark some frameworks:

$ bash setup.sh fatfree-3.5/ slim-3.0/ lumen-5.1/ silex-1.3/
$ bash benchmark.sh fatfree-3.5/ slim-3.0/ lumen-5.1/ silex-1.3/

Linux Kernel Configuration

I added below in /etc/sysctl.conf

# Added
net.netfilter.nf_conntrack_max = 100000
net.nf_conntrack_max = 100000
net.ipv4.tcp_max_tw_buckets = 180000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 10

and run sudo sysctl -p.

If you want to see current configuration, run sudo sysctl -a.

Apache Virtual Host Configuration

<VirtualHost *:80>
  DocumentRoot /home/vagrant/public
</VirtualHost>

References

Other Benchmarks