Skip to content

Commit 0cea8ab

Browse files
committed
Update README.MD & Screenshots
1 parent 555abc2 commit 0cea8ab

9 files changed

+125
-74
lines changed

README.md

Lines changed: 125 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
1-
# PHP Frameworks Bench v1.2
1+
# PHP Frameworks Bench
2+
![GitHub release (latest by date)](https://img.shields.io/github/v/release/myaghobi/PHP-Frameworks-Bench?color=purpol) ![GitHub](https://img.shields.io/github/license/myaghobi/PHP-Frameworks-Bench?color=green)
23

3-
This project attempts to measure minimum overhead (minimum bootstrap cost) of PHP frameworks in the real world.
4+
This project attempts to measure the minimum overhead (minimum bootstrap cost) of PHP frameworks in the real world.
45

5-
So I think the minimum applications to benchmark should not include:
6+
So I think the minimum should not include:
67

78
* cost of template engine (HTML output)
89
* cost of database manipulation
910
* cost of debugging information
1011

11-
Components like Template engine or ORM/Database libraries are out of scope in this project.
12+
Components like Template engines or ORM/Database libraries are out of scope in this project.
13+
14+
15+
- [PHP Frameworks Bench](#php-frameworks-bench)
16+
- [Benchmarking Policy](#benchmarking-policy)
17+
- [How to Benchmark](#how-to-benchmark)
18+
- [Commands](#commands)
19+
- [Benchmarks](#benchmarks)
20+
- [Latest](#latest)
21+
- [Old](#old)
22+
- [OPCache](#results-with-opcache)
23+
- [References](#references)
24+
- [License](#license)
25+
26+
1227

1328
## Benchmarking Policy
1429

@@ -19,33 +34,116 @@ This is `master` branch.
1934
* Don't remove any components/configurations even if they are not used.
2035
* With minimum changes to run this benchmark.
2136
* Set environment production/Turn off debug mode.
22-
* Run optimization which you normally do in your production environment, like Composer's `--optimize-autoloader`.
23-
* Use controller or action class if a framework has the functionality.
37+
* Run the general optimization in your production environment, like `--optimize-autoloader` for the composer.
38+
* Use controller or action class.
2439

25-
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.
40+
Some frameworks are optimized, some are not, so some people may think using default configuration is not fair. The dept of optimizing a framework depends on the developer's knowledge & experienced, it's the rabbit hole and there is no point in that for benchmarking. I think the default configuration of frameworks is a good starting point to have the ranking points.
2641

27-
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.
42+
If you find something wrong with my code, please feel free to send Pull Requests. But please note optimizing for the "Hello World" is not acceptable! Building the fastest "Hello World" application is not the goal of this project.
2843

29-
## Results
3044

31-
### Benchmarking Environment
45+
## How to Benchmark
3246

33-
* Windows 10 64bit (bash executed on WSL 2)
34-
* PHP 8.0 (XAMPP x64)
47+
If you want to benchmark PHP extension frameworks like Phalcon, you need to install the extenstions.
48+
49+
1- Install source code as <http://localhost/php-frameworks-bench/>:
50+
51+
```
52+
$ git clone https://github.com/myaghobi/php-frameworks-bench.git
53+
# or use git clone https://github.com/myaghobi/php-frameworks-bench.git --branch vx.x
54+
$ cd php-frameworks-bench
55+
$ bash setup.sh
56+
```
57+
58+
2- Run benchmarks:
59+
60+
```
61+
$ bash benchmark.sh
62+
```
63+
64+
3- Check the resuts:
65+
66+
<http://localhost/php-frameworks-bench/>
67+
68+
## Commands
69+
70+
```
71+
# install | create-project frameworks
72+
$ bash setup.sh
73+
74+
# run the benchmark
75+
$ bash benchmark.sh
76+
77+
# composer update
78+
$ bash update.sh
79+
80+
# to clean them all
81+
# then you can use setup.sh
82+
# trobble? use it with `sudo`
83+
$ bash clean.sh
84+
```
85+
86+
To specify the frameworks, put them after each command:
87+
88+
```
89+
$ bash benchmark.sh laravel-9.1.3/ slim-4.10/ fatfree-3.7.3/
90+
...
91+
```
92+
93+
94+
## Benchmarks
95+
96+
### Latest
97+
98+
#### Environment
99+
100+
* Ubuntu 20.04 LTS 64bit
101+
* PHP 8.1.4 (LAMP)
35102
* CPU Core i7 2600K@4Ghz
36103
* Memory 16G
37104

38105

39-
### Hello World Benchmark
106+
#### Results (2022/5/9)
40107

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

43-
(2021/12/01)
110+
![Benchmark Results Graph Throughput](screenshots/php-frameworks-bench-throughput.png)
111+
![Benchmark Results Graph Memory](screenshots/php-frameworks-bench-memory.png)
112+
![Benchmark Results Graph Execution Time](screenshots/php-frameworks-bench-exectime.png)
113+
![Benchmark Results Graph Included Files](screenshots/php-frameworks-bench-includedfiles.png)
114+
115+
PHP 8.1.4 (LAMP)
116+
|framework |requests per second|relative|peak memory|relative|
117+
|-------------------|------------------:|-------:|----------:|-------:|
118+
|pure-php | 25,363.33|25,363.3| 0.34| 0.3|
119+
|phroute-2.1 | 20,871.63|20,871.6| 0.34| 0.3|
120+
|fastroute-1.3 | 20,692.36|20,692.4| 0.34| 0.3|
121+
|siler-1.7.9 | 15,140.00|15,140.0| 0.36| 0.4|
122+
|fatfree-3.8.0 | 13,172.39|13,172.4| 0.39| 0.4|
123+
|slim-4.10 | 10,863.08|10,863.1| 0.38| 0.4|
124+
|slim-3.12 | 10,630.10|10,630.1| 0.39| 0.4|
125+
|yii-2.0-basic | 8,382.51| 8,382.5| 0.69| 0.7|
126+
|silex-2.3 | 8,017.40| 8,017.4| 0.39| 0.4|
127+
|symfony-5.4 | 7,309.46| 7,309.5| 0.46| 0.5|
128+
|symfony-6.0 | 7,272.85| 7,272.9| 0.45| 0.5|
129+
|lumen-9.0.0 | 4,990.60| 4,990.6| 0.39| 0.4|
130+
|cakephp-4.3 | 4,471.16| 4,471.2| 0.43| 0.4|
131+
|fuelphp-1.9 | 3,728.35| 3,728.4| 0.45| 0.5|
132+
|codeigniter-4.1.9 | 1,671.15| 1,671.2| 1.46| 1.5|
133+
|laravel-9.1.3 | 826.64| 826.6| 0.77| 0.8|
134+
135+
136+
### Old
137+
138+
#### Environment
139+
140+
* Windows 10 64bit (bash executed on WSL 2)
141+
* PHP 8.0 (XAMPP x64)
142+
* CPU Core i7 2600K@4Ghz
143+
* Memory 16G
144+
44145

45-
![Benchmark Results Graph Throughput](screenshots/php-frameworks-bench-throughput.jpg)
46-
![Benchmark Results Graph Memory](screenshots/php-frameworks-bench-memory.jpg)
47-
![Benchmark Results Graph Execution Time](screenshots/php-frameworks-bench-exectime.jpg)
48-
![Benchmark Results Graph Included Files](screenshots/php-frameworks-bench-includedfiles.jpg)
146+
#### Results (2021/12/01)
49147

50148
|framework |requests per second|relative|peak memory|relative|
51149
|-------------------|------------------:|-------:|----------:|-------:|
@@ -66,67 +164,13 @@ These are my benchmarks, not yours. **I encourage you to run on your (production
66164
|laravel-8.6.6 | 39.96| 40.0| 11.90| 11.9|
67165

68166

69-
### Hello World Benchmark with OPCache
167+
### Results with OPCache
70168
[![IMAGE ALT TEXT](http://img.youtube.com/vi/BUcxalvD92U/0.jpg)](http://www.youtube.com/watch?v=BUcxalvD92U "PHP OPCache Benchmarks, a Comparison for Popular Frameworks")
71169

72170

73-
## How to Benchmark
74-
75-
If you want to benchmark PHP extension frameworks like Phalcon, you need to install the extenstions.
76-
77-
Install source code as <http://localhost/php-frameworks-bench/>:
78-
79-
~~~
80-
$ git clone https://github.com/myaghobi/php-frameworks-bench.git
81-
$ cd php-frameworks-bench
82-
$ bash setup.sh
83-
~~~
84-
85-
Run benchmarks:
86-
87-
~~~
88-
$ bash benchmark.sh
89-
~~~
90-
91-
See <http://localhost/php-frameworks-bench/>.
92-
93-
If you want to benchmark some frameworks:
94-
95-
~~~
96-
$ bash setup.sh fatfree-3.7.3/ slim-4.9/
97-
$ bash benchmark.sh fatfree-3.7.3/ slim-4.9/
98-
~~~
99-
100-
## Linux Kernel Configuration
101-
102-
I added below in `/etc/sysctl.conf`
103-
104-
~~~
105-
# Added
106-
net.netfilter.nf_conntrack_max = 100000
107-
net.nf_conntrack_max = 100000
108-
net.ipv4.tcp_max_tw_buckets = 180000
109-
net.ipv4.tcp_tw_recycle = 1
110-
net.ipv4.tcp_tw_reuse = 1
111-
net.ipv4.tcp_fin_timeout = 10
112-
~~~
113-
114-
and run `sudo sysctl -p`.
115-
116-
If you want to see current configuration, run `sudo sysctl -a`.
117-
118-
## Apache Virtual Host Configuration
119-
120-
~~~
121-
<VirtualHost *:80>
122-
DocumentRoot /home/vagrant/public
123-
</VirtualHost>
124-
~~~
125-
126-
127171
## References
128172
Note: This project is based on
129-
[php-framework-benchmark](https://github.com/kenjis/php-framework-benchmark). It was very old and no longer maintained, so I decided to split it from the origin repo and update it separately.
173+
[php-framework-benchmark](https://github.com/kenjis/php-framework-benchmark). It was very old and abandoned, so I decided to split it from the origin and update it separately.
130174

131175
* [CakePHP](https://github.com/cakephp/cakephp)
132176
* [CodeIgniter](https://github.com/codeigniter4/CodeIgniter4)
@@ -141,3 +185,10 @@ Note: This project is based on
141185
* [Slim](https://github.com/slimphp/Slim)
142186
* [Symfony](https://github.com/symfony/symfony)
143187
* [Yii](https://github.com/yiisoft/yii2)
188+
189+
190+
## License
191+
192+
You are allowed to use this plugin under the terms of the GNU General Public License version 2.
193+
194+
Copyright (C) 2022 Mohammad Yaghobi
-61.9 KB
Binary file not shown.
25.2 KB
Loading
-57.3 KB
Binary file not shown.
24.5 KB
Loading
-59.1 KB
Binary file not shown.
26 KB
Loading
-62.4 KB
Binary file not shown.
25.5 KB
Loading

0 commit comments

Comments
 (0)