PHP Framework BenchmarkThis project attempts lớn measure minimum overhead (minimum bootstrap cost) of PHP frameworks in the real world.
Bạn đang xem: Php mvc framework showdown: 7
So I think the minimum applications khổng lồ benchmark should not include:cost of template engine (HTML output)cost of database manipulationcost of debugging information
Components like Template engine or ORM/Database libraries are out of scope in this project.
Benchmarking PolicyThis is master branch.Install a framework according to the official documentation.Use the mặc định configuration.Don"t remove any components/configurations even if they are not used.With minimum changes lớn run this benchmark. Set environment production/Turn off debug mode.Run optimization which you normally vì chưng in your production environment, lượt thích Composer"s --optimize-autoloader.Use controller or kích hoạt class if a framework has the functionality.
Some people may think using mặc định configuration is not fair. But I think a framework"s default configuration is an assertion of what it is. Mặc định configuration is a good starting point lớn 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 cảnh báo optimizing only for "Hello World" is not acceptable. Building fastest "Hello World" application is not the goal in this project.
Benchmarking EnvironmentCentOS 6.8 64bit (VM; VirtualBox)PHP 5.6.30 (Remi RPM)Zend OPcache v7.0.6-dev Apache 2.2
Hello World BenchmarkThese are my benchmarks, not yours. I encourage you to lớn run on your (production equivalent) environments.
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 lớn BenchmarkIf you want lớn 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
$ 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/
# Addednet.netfilter.nf_conntrack_max = 100000net.nf_conntrack_max = 100000net.ipv4.tcp_max_tw_buckets = 180000net.ipv4.tcp_tw_recycle = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_fin_timeout = 10
and run sudo sysctl -p.
If you want to lớn see current configuration, run sudo sysctl -a.
Apache Virtual Host Configuration
According khổng lồ http://taylorotwell.com/how-lumen-is-benchmarked/ :
| framework | requests per second || --- | --: || Slim 2 | 1700-1800 || Lumen | 1800-1900 || Slim 3 | 1200-1300 |Lumen is a bit faster than Slim2.
| framework | requests per second || --- | --: || slim-2.6 | 774.31 || lumen-5.0 | 372.07 |Slim2 is about two times faster than Lumen.
I"ve found some differences in code, but overall benchmarking methodology seems to lớn be the same.
don’t be surprised if your numbers are different than my numbers.
Yes, benchmarking environments change numbers. But the difference (relatively khổng lồ Slim2) is too much, isn"t it?
I simply want lớn know why. What makes the huge difference?
I have made a few changes lớn correct how the frameworks was being used, specially echoing in the controller which is not an accepted practice in the community.
I have also made some slight changes for performance in a way that they are still fair lớn the other frameworks in this repository:Only connected a single route. The majority of the other framework samples only had 1 route.Removed development plugins, there is no need for themRemoved the development oriented "AssetsDispatcher". That"s an usual common practice before going live.Removed the use of unused component in the application, loading code that is not needed by default is not something you would vị in a normal application.
I have a question about Phalcon Benchmarking. Since we haven"t installed the extension of Phalcon và we haven"t configured anything on our server, how can then phalcon run?If you read the documentation of Phalcon https://docs.phalconphp.com/en/latest/index.htmlyou know what I mean.So my question is Phalcon benchmarking legitimate? Personally I don"t know, but when I have tried to xuất hiện the link of the phalcon-2.0 ứng dụng that being generated after I run the benchmark, I got an error và I couldn"t open the link : http://127.0.0.1/php-framework-benchmark/phalcon-2.0/public/index.php?_url=/hello/index
kenjis thanks for creating this benchmark of PHP frameworks & thanks for including Symfony in it.
I was checking the configuration of the tested Symfony application và I realized that it"s not correct. The problem is that right now Symfony is loading a lot of things that are unneeded for the benchmark (database access, logs, emails, etc.)
I propose you the changes included in this pull request to lớn disable anything that Symfony doesn"t need to run the test. I"d be great if you could accept this pull request and re-run the benchmark tests. If you have any question about these changes, please ask me. Thanks!
First of all thank you very much for making such a great tool to lớn benchmark all the php-frameworks. I have question about the bash script located in _functions.shthis ab -c 10 -t 3 "$url" > "$ab_log"do the actual test.It"s not clear for me how many request per seconds are sent khổng lồ the framework. I have read the documentation about ab và we should specify the amount of requests with -n. I didn"t see that in your benchmarking, correct me if I am wrong, please! :+1:
Please can you maybe explain what you are doing? I mean how much request or maybe how many concurrent users.
I have ran the benchmark for Symfony 3.0 and Laravel5.2 & I got the following results.
What I don"t understand what does memory usage here mean? I mean I didn"t know how many requests are sent và also what the is relation between theses results.For example Symfony could handle 639 rps và has spent 7.879 ms with 2.92 MB memory usage. 214 files were included.
This is specifications of my máy tính xách tay where I have done the benchmark.
These are the results: