PHP Framework MVC Benchmark - v20111201-4

2011-12-01 19:01:15 Tech Views(274696)

Case

Test Simple "Hello World" page output, Simple MVC logic(Router -> Controller -> Viewer), No Database Connections, No complex logic.

Hardware platform
CPU: Intel Core i5 750 (2.67GHz x4)
RAM: 4GB

Software Environment

Debian 6.0.4 x86_64 (2.6.32-41)

apache 2.2.16 (mpm-prefork,mod-php5)

php 5.3.10
php-apc 3.1.9 (Optimization for include/require)

Copy all projects to /dev/shm/* (Optimization for files read/write)

Frameworks list

* zf: Zend Framework
Site: http://framework.zend.com
Ver: 1.11.11

* zf2: Zend Framework
Site: http://framework.zend.com
Site: https://github.com/zendframework/ZendSkeletonApplication
Ver: 2.0.0-beta1

* symfony: symfony
Site: http://www.symfony-project.org
Ver: 2.0.0

* cakephp: CakePHP
Site: http://cakephp.org
Ver: 2.0.4

* ci: CodeIgniter
Site: http://codeigniter.com
Ver: 2.1.0

* yii: Yii Framework
Site: http://www.yiiframework.com
Ver: 1.1.8

* micromvc4: MicroMVC
Site: http://www.micromvc.com
Ver: 4.0.0

* laravel: Laravel, A PHP Framework For Web Artisans
Site: http://laravel.com
Ver: 2.0.2

* slim: Slim Framework
Site: http://www.slimframework.com
Ver: 1.5.0

* yaf: Yet Another Framework in PHP Extension
Site: http://code.google.com/p/yafphp
Ver: 2.1.3-beta (yaf.cache_config=1)

* FuelPHP: Simple, Flexible, Community driven Web Framework
Site: http://fuelphp.com/
Ver: 1.1

* ColaPHP:
Site: http://code.google.com/p/colaphp/
Ver: 1.2-ga

# XHProf: A Hierarchical Profiler for PHP
Site: http://pecl.php.net/xhprof
Ver: 0.9.2

# The source code of this testing:
Source: https://github.com/eryx/php-framework-benchmark

1. Apache Benchmark

Requests pre second (-c 100 -n 30000), the bigger is better

Requests pre second (-c 200 -n 50000), the bigger is better

2. System LoadAvg
System LoadAvg in 1 Minute when Apache Benchmark Complete,
the smaller is better (-c 100 -n 30000)

3. Memory usage
How many memory usage in one "hello world" page. the smaller is better.

4. Response time
The time of page request to response.

5. Number of function calls (Facebook XHProf)
The number of functions calls in one "hello world" page.

The detail of function calls map

Symfony2 Zend Framework 1.11.1
Zend Framework 2.0.0-beta1 CakePHP 2.0.4
CodeIgniter 2.1.0 Yii Framework 1.1.8
Slim 1.5 Laravel 2.0.2
MicroMVC 4.0.0 Yaf 2.1.3-beta
FuelPHP 1.1 ColaPHP 1.2

6. Number of Files
The number of files included or required in one "hello world" page. the smaller is better.

Changelog:
* v20111201 @2011-12-01
- release

* v20111201-2 @2011-12-05
- bugfix: Fix a stupid logic error in bench.php
- bugfix: Symfony2, Change running mode from 'dev' to 'prod'

* v20111201-3 @2012-02-29
- New: new frameworks added: fuelphp, colaphp

* v20111201-4 @2012-05-18
- Optimized configuration for symfony2 (Commit By https://github.com/Smart-Core)
Patch https://github.com/eryx/php-framework-benchmark/pull/2

--EOF--

Comments

laruence

thanks for your work~ :)

2011-12-02 14:04:05

Matthias Breddin

Why would you benchmark Symfony 2 in dev mode?

2011-12-02 22:46:48

rui

@Matthias Breddin
Just the beginning, I tried to use app.php to boot, but failed (500 error); at the same time app_dev.php work well. In order to output a simple "hello world" page, I modified the config_dev.yml([web_profiler] toolbar: false; intercept_redirects: false).
I think, although the mode name is "dev", but because the debug was disabled, in fact the "app.php" was equal with "app_dev.php" ?
I was the first time using symfony, If the configuration can be optimized, expect you to submit patch :)
https://github.com/eryx/php-framework-benchmark (symfony2)

2011-12-02 23:51:57

stof

@rui

According to the function calls map, the profiler was activated, which slows the app and increase memory usage.
The AsseticBundle routing was also enabled, which makes checking the routing cache more expensive.

The app was clearly in debug mode. Putting toolbar:false in the config does not disable the debug mode (which is not even handled in the config file) but simply disable displaying the toolbar.

2011-12-03 01:52:20

rui

@stof

Thanks for your reminder, I will modify the configuration and redo the test for symfony.

2011-12-03 14:15:23

mindaugas

you forgot to include two more great frameworks:

1. index.php: <?php echo "Hello world;" ?>
2. index.html:

Hello world

your tests are totally useless

2012-01-05 16:32:13

guest

It doesnt seem like the laravel framework is excecuting a controller in the test.

2012-01-13 17:50:43

guest

how do I run this benchmark on my own server? I tried downloading the code from github but that didnt work too well

2012-01-13 22:58:10

guest

guest above: you can use routes instead of controllers in laravel.

I love how the big framework guys moan at the shitty performance of symfony and zend.

2012-01-13 23:20:35

Zack Kitzmiller

Why not FuelPHP?

2012-01-13 23:28:53

rui

"how do I run this benchmark on my own server?"

i have just update the "README" file, How to run this benchmark

2012-01-17 17:09:47

srikanth

it's good

2012-01-22 15:07:34

guest

This is very interesting. Can you benchmark more frameworks? I would like to see you test these others:

Silex: http://silex.sensiolabs.org/
Flight PHP: http://flightphp.com/
Phraw PHP: http://phraw.dav-muz.net/
Lithium: http://lithify.me/
FuelPHP: http://fuelphp.com/

2012-01-23 14:57:24

Jose Lorenzo

apache benchamark, seriously?
"Hello world" ? come on! Why would you use a framework for that?
Testing mode is some frameworks?

I feel like this benchmark has no real value, data is hard to trust in.

2012-02-03 23:03:26

bobby

documentation on yaf is kinda lacking but http://yaf.dashexamples.com/ seems to be your best bet. The guy has been pretty good about responding to my questions.

2012-02-04 14:57:14

EnZo

Amazing work. Thx so much!

2012-02-09 08:57:03

beberlei

@rui it seems the security component for Symfony is enabled (app.security.isGranted() called in a template), not sure if the others have ACL and user checking enabled, but according to the callgraph it accounts for 35% of the request, whereas others are probably unauthenticated hello worlds.

2012-02-22 22:24:34

rui

@beberlei Thanks for your suggestion, I will try to turn off this parameter in the next time.

2012-02-24 11:15:39

guest

Good job Rui. This is a great general overview. 谢谢你的分享.

2012-02-24 12:09:38

daniel

Let's say we have a stick, a gun, a tank and a bomb. Lets do some benchmarks on which one is better to kill an ant. Don't forget to count the time it takes to load each if necessarily.

This benchmarks are very good, but don't chose a framework solely on this.

2012-03-01 14:25:58

John

Excelent work with those Benchmarks. Thank you very much.

By the way, Laravel 3.0 (stable) was released a week ago. It would be interesting to include in the benchmark.

Finally of the most popular Framewoks, only Kohana is missing.

http://kohanaframework.org/

PD: Sorry for my bad English.

2012-03-02 01:46:17

guest

Doophp should be in that list

2012-03-07 17:01:12

Jim

Thank you very much, keep up the good work :)

2012-03-14 09:14:35

guest

Your fuelphp comparison is off :(
Looking through the code, your CI app, loads a view that is pure HTML.   The FuelPHP controller, does a LOT more.   There is CSS, decoding an image, etc.   You might want to redo it with the same view that you used for CI :)

2012-03-14 16:46:09

rui

the fuelphp is also use the "pure HTML", no css/image etc.

see "fuel/app/views/welcome/index.php"

2012-03-14 21:39:40

jminkler

You stated that APC was running

php-apc 3.1.9 (Optimization for include/require)

But you did not change symfony to use ApcUniversalClassLoader.php

"For better performance, you can use the APC based version of the universal class loader:

require_once __DIR__.'/src/Symfony/Component/ClassLoader/UniversalClassLoader.php';
require_once __DIR__.'/src/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php';

use Symfony\Component\ClassLoader\ApcUniversalClassLoader;

$loader = new ApcUniversalClassLoader('apc.prefix.');

Furthermore, the component provides tools to aggregate classes into a single file, which is especially useful to improve performance on servers that do not provide byte caches."

2012-03-20 12:34:59

rui

@jminkler
Thank you for reading the source code, I will continue to optimize the configuration of framework, and update the test data next time.

2012-03-21 22:06:36

Andrea

Excellent work...

Can you test with nginx http server?

A.

2012-03-29 15:19:21

aktuba

Please add kohana 3.0 and kohana 3.2

2012-04-06 15:42:42

guest

Awesome! Would love to see MODX (modx.com) in there

2012-04-12 03:05:31

guest

Would like to see Laravel 3.1.9 here

2012-04-22 06:32:11

guest

Hello world comparison worth nothing if you need more than hello world "application", if you don't need more than that why are you looking at frameworks?

frameworks should help you develop big applications, that's why they have overhead. Bigger overhead and more functions are just signs of a frameworks that does more for you.

If you want a real comparison, compare a real app!

2012-04-23 14:58:44

Shay Ben Moshe

Thank you, great benchmark.

Can you also add Lithium, FuelPHP and Fat Free?

Thanks!

2012-05-03 16:22:32

guest

wow Thank you
very very very usefull :D

2012-05-10 00:28:18

guest

add Kohana plz

2012-05-10 00:28:53

rui

Thank you for your attention. I will wait for a period of time (6-12 months) in order to wait for each framework can have a greater milestone updated and optimized. of course will add more frameworks :)

2012-05-10 21:31:38

guest

Thank you, great benchmark.
Can you also add DooPHP http://doophp.com/
Thanks!

2012-05-12 21:22:23

guest

With Yii is possible to include yiilite.php instead which made it both faster and include less files.. If I get the time I will run the benchmark again.

2012-05-16 16:28:45

smart-core

Please upload my optimized configuration for "hello world" and update the benchmarks.

https://github.com/Smart-Core/php-framework-benchmark/commit/b0895581229f87845264bb4ba2e3cfd6087f6840

2012-05-16 23:16:53

smart-core

oops :) this is correct pull request:

https://github.com/eryx/php-framework-benchmark/pull/2

2012-05-17 00:00:41

rui

About use yiilite.php in Yii:
I try to use yiilite.php replace yii.php, the "include files" reduced from 19 to 4, but the memory-usage is increased from 1180KB to 2389KB, the QPS lower.

2012-05-18 13:56:21

Abdullah Al Mamun

Great work. Thanks a lot.
But where is Kohana (most elegant one)?

2012-05-21 08:13:06

guest

Thanks for an awesome comparison!
Kohana is the only one missing, it would be great if you could add it.
If you could keep this up to date with any major stable releases in the future this would be an awesome reference!

2012-05-29 18:38:42

rui

The next major update will be at the end of this year.
the Kohana, DooPHP framework will be added :)

2012-05-30 10:10:13

Salih BiLGiN

I helped my choices. This comparison is that you do. So which framework you use? Which is also good in a photo processing?

2012-06-02 18:53:59

Andrei

The benchmark is excellent. What a framework must basically do is organize code. What this benchmark does is it tests the MVC part. "Hello world" ensures that the network card isn't the bottleneck. If yaf lacks fancy email and ACL, take it from Zend, but for the most part, a framework must dispatch requests.
PS: on such a server, 7000 requests/second on Apache is all you can hope for. Even an index.html will be as slow. If you want to take PHP to the limit, set AllowOverride None in httpd.conf and move the rewrite rules to a entry. The whole .htaccess finding and applying routine is lagging Apache terribly. Then yaf might output something like 15000 requests/second.

2012-06-17 06:26:17

SCIF

Thanks for very interest and explained benchmark!

Can you retest these frameworks with new versions of it?

System load diagram is very interest. I think that you must use nginx + PHP-FPM for better productivity. I can help with setting it up.

Thank!!

2012-06-29 16:19:43

guest

I was tested my ZF app with ab and discovered diferent numbers like 2493 conections per second.
My machine? not more wich a windows xp 32bits dualcore 2.53Ghz with 2gb of RAM.

2012-07-02 23:19:27

Riyan

Ruby on Rails is great. It's a very good thing to learn if you're a PHP coder without MVC exinpreece. Frameworks to PHP are (sort of) what Rails is to Ruby    it makes you organize your code.I remember giving up on Code Igniter because it supported PHP4, effectively ruining the whole object-oriented paradigm. Symfony has impressive features (hello there, profiler) and great tutorial; but I gave up on Symfony when I realized it wasn't all that easy to learn    using relatively exotic languages (like YAML) and annotations (just   ugh), which seemed unnecessarily complicated. Zend Framework on the other hand is nicely structured and loose enough not to be the central problem in the application, but has a very poorly written Quickstart Tutorial, which needs a few days to complete, and not a few hours as it claims. CakePHP has a large   cookbook   database, but most of it is user-uploaded and poorly written.There is no   best ever   framework, it all depends on what you need. Don't seek perfection, young grasshopper. Frameworks are like hammers; they all are made to bang on things, but come in various sizes and shapes, because you wouldn't want to carve stone with a carpenter's hammer.

2012-07-04 13:01:44

guest

Any chance you could include KohanaPHP latest version? I have had a long time soft spot for Kohana and it realy looks like it has come a long way and now offers a lovely HMVC light approach.

2012-07-05 22:12:18

aris

What about compare with php limonade too?

https://github.com/sofadesign/limonade

PHP limonade is MVC/VC framework use procedural style programming. As it not use any object I think it will result similar performance with Yaf or out perform Yaf :).

Limonade size: 2671 lines (2397 sloc) 75.841 kb (low memory usage winner)
Limonade watch: 479, fork: 56

-thanks

2012-07-17 13:42:05

guest

I'd be curious to see how AgilePHP stacks up against other full stacks.   http://agilephp.org/

2012-08-11 03:52:07

guest

Just came across this framework built as a C extension. Would be interested to see how it fairs against everything else   http://phalconphp.com/

2012-08-15 07:06:50

guest

Guys, don't choose a framework based on those benchmarks.

I quote Harro Verton :
http://fuelphp.com/forums/topics/view/8182

ou always have to be careful with interpreting results like this. Every framework is designed different, and that design can have an influence on the test results in a specific test case. Same for the way the "Hello World" example is coded.

For example, FuelPHP 1.x loads quite a few core files on startup, which might be noticable in benchmarks on systems with relatively slow I/O. But this number doesn't really increase when you build your app.

Another example: FuelPHP's "Hello World" example contains a fully functional controller, including loading css, images, and twitter bootstrap. It also uses a ViewModel. Compare that to CI's version, which only echo's a few lines of text.

And finally, performance isn't everything. By definition every layer of abstraction adds complexity and makes things a bit slower. We feel that is acceptable (within limits off course) if there are enough gains elsewhere. FuelPHP is a framework designed for large/corporate applications. In such environments, the speed of development is a big part of the total cost, so that the cost of a slightly faster server isn't really significant.

2012-08-16 23:52:45

guest

You should include Silex

2012-08-20 23:13:18

shama

I pity the fool who thinks frameworks can be benchmarked against each other in this way.

2012-08-21 01:09:02

DAE51D

I agree with "mindaugas" that you need to also have a 'control' benchmark to index.html and index.php for comparison.

2012-08-21 06:31:59

guest

The Photon framework is missing.

2012-08-21 07:57:41

guest

what about compare with Phalcon? http://phalconphp.com/

2012-08-21 16:49:19

guest

would love to see Kohana added to this list

http://www.kohanaframework.org

2012-08-21 17:45:29

guest

Agrh! One more voice in the crowd cheering for inclusion of Kohana in this benchmark!

Kohana, Kohana, Kohana!

Kohanians, unite and conquer!

2012-08-21 23:56:46

guest

Where is Kohana, the most elegant one?

2012-08-22 01:41:38

guest

This bencmark is a joke... Zend Framework 2 beta1 is ancient... ZF2 is up to RC4, about to go stable. Beta1 had many known performance issues, which have long since been addressed.

And Symfony 2 in development mode? Seriously?

You should seriously consider removing such a misleading post from your blog until you can learn to do a proper benchmark. Have a look at some of Paul Jones stuff, http://paul-m-jones.com/category/programming/benchmarks

Also consider that ZF1, for example, has no layout enabled and uses no view helpers by default. ZF2'sdefault skeleton application, on the other hand illustrates practical usage of the URL view helper, gettext transations, layouts, etc. Even a basic hello-wold example is nowhere close to a fair comparison.

2012-08-23 06:15:47

guest

ZF2 is at RC7 now, and still has so many performance issues that it's an absolute joke.

This is a pretty fair benchmark IMO and accurately represents the 'overhead and bloatedness' that different ones bring to the table.

And from personal experience ZF2 is indeed like Jabba the Hut in comparison to everything else.

2012-09-04 00:15:08

Bruno Batista

Please update the benchmark for Laravel 3.2.7 :)

2012-09-04 19:14:37

guest

Just came across this framework built as a C extension. Would be interested to see how it fairs against everything else    http://phalconphp.com/

2012-09-10 09:47:10

guest

great benchmark, please uptodate framework version.

2012-09-15 01:07:25

guest

PLEASE update the benchmark with latest versions.
also PLEASE include Phalcon PHP.

thanks!

2012-09-19 05:01:52

Igor

I agree this bencmark is joke. ZF2 is now full realised.

2012-09-19 16:15:02

guest

yes, please add PhalconPHP!!!

2012-09-28 21:20:38

masterblaster

UPDATE!!!!

http://www.laruence.com/2012/09/16/2791.html

2012-10-06 04:36:05

guest

Need an update with all last released framework

Symfony 2.1.x
ZF2
silex
etc...

2012-10-16 21:15:15

guest

What these benchmarks do show is if your writing simple apps don't use the big frameworks.

It shows ZF2 beta1 did have major performance issues and whilst yes it might be loading everything but the kitchen sink. With a larger application it would still be slow.

Good work on the article, whilst there has been a few bugs in the testing procedure (as already pointed out), the article still has quite a bit of significance.

And for those people complain about out of date versions of the framework - looking at the date of the article before ignorantly blasting the author.

Keep up the good work!

2012-10-23 21:36:12

guest

waiting for the test with updated frameworks!

2012-11-06 18:05:48

guest

Hi Rui,

This is good. May I know what application was used to get the include functions map?

2012-11-13 18:03:14

guest

First of all thanks very much.

If you repeat the benchmark, please add flow3 to your framework list

2012-11-16 00:37:27

guest

More recent benchmarks (NOV. 2012):

http://www.comentum.com/web-application-framework-comparison.html

2012-11-21 06:59:31

Alex Belyaev

Please, add to comparison - phalconphp - php framework fully compiled inc C extension for PHP. In benchmarks from phalcon's authors - hi is the fastest php framework ever

2012-11-23 15:45:00

Alex Belyaev

and ofcourse very interesting to be added - is YAF (http://www.php.net/manual/en/intro.yaf.php)

2012-11-23 16:59:21

guest

I really appreciate the time and effort that was put into doing this.   Does Hello World really indicate framework performance, I guess that's up for debate, however, I still this it's a valid benchmark to generally see how these frameworks handle the basics.

zf2 is in production, so these tests really, to be fair, shouldn't be run against a beta that was in development.   It would be nice to see the real numbers of the production release.   zend claims it's twice as fast as zf1.

2012-12-03 12:15:14

guest

I'd like to see the Zend Framework production version on there. It'd be interesting to see if they've managed to reduce load etc since the tests,

2012-12-07 22:18:37

guest

There is another benchmark in terms of page generation speed here: http://phpixie.com/blog/php-framework-benchmark/

2013-01-03 00:16:51

Lito

Hi! can you add the phpCan PHP framework? https://github.com/eusonlito/PHPCan

I can send you a controller file with your requirements.

Regards,
Lito.

2013-02-07 21:44:36

DimkOf

Please add Kohana Framework version >=3.2
http://kohanaframework.org

2013-02-13 13:08:46

guest

Please add: Laravel 3.2.13

2013-02-28 20:33:22

Xenon

Is there an Update to this tests ?
Laravel is now 3.2 version.

2013-03-04 04:48:10

arobase

aktuba if you want to do a performance test kohana you can easily do yourself there are sources on github, kohana and the passage does not worth to be tested for the framework as it was managed is certainly not the framework to use professionally I said! therefore a performance test kohana would be completely useless here no thank you

2013-03-21 00:28:47

guest

Hello, I really enjoyed this comparison. Yesterday I met the Phalcon php framework, would be interesting if you add it in this comparison.

http://phalconphp.com/

2013-03-30 23:57:47

guest

Really? Hello world. Whats the point.   IF you really want to bench mark frameworks you need to include more in depth test like routes, db layers etc. Even then they will never quite beat out pure PHP.   Half the point of frameworks is developer speed opposed to application speed

2013-04-08 19:15:57

guest

How to lotusphp?

2013-05-27 10:52:11

wuha

how to generate the function map call?

2013-08-07 17:05:52

guest

very good

thank you very much

2013-10-12 08:43:35

guest

kohana?

2013-10-17 22:19:39

guest

kohana?

2013-10-17 22:20:17

ikhsan

great comparison,

but, how about updating laravel to version 4.1 (and other framework too :D)

2013-12-24 15:53:51

hidayet

Thank you for this great work.

Please do this benchmark again and refresh results...

2014-01-28 02:09:47

guest

I think about idea that MVC framework structure+parts should be part of native PHP language 3.5 years.

This month when i really far a way from PHP somebody send me link to PHALCON - almost like my idea. I think also python and ruby should have native framework that will run much faster.

Today steps that PHP have to do to survive node.js/rails/python raise:

1. Phalcon should be integrated to be part of PHP 5.6 soon as possible - this will awake PHP from loose to ruby.

2. Also should be in 5.6 create functions instead today functions that will be consistent like in python- all this function should start with s_print, s_split_words() etc...

3. Add asynchronous native engine to PHP as NODE.JS

4. Take Facebook HipHop or like that engine and make it part of native PHP. Its big importance for ecommerce systems to compile code before deploy to production for prevent errors/warning/bugs in compile time and fix them before they will naybe discovered by users in run time. (It exist opinion of unit tests that prevent that - they not prevent this issues in views+ in agile project all time demands changes and write all time unit test that big part of him going to garbage make script programming slow vs C#/SCALA)

2014-02-17 04:36:03

Jhon

Thank you for this great work.

Just came across Cygnite Framework, interesting. I would love to see Cygnite Framework in the list.

http://www.cygniteframework.com

Thanks.

2014-04-26 00:47:13

guest

只拿 一个helll world来做 ab 测试。没有任何意义可言。
因为最终的项目 不是在写hello world.会有各种业务需求 穿插在其中。ZF是企业级框架,完全没有可比性!

2014-10-15 15:37:15

Hari KT

Would like to see Aura PHP v2 and how it performs :-) .

2014-11-04 11:25:18

guest

I wish to see performance of Cygnite PHP Framework – “The new Cool Kid” http://www.cygniteframework.com/

I just done my CRUD application within 2 min and seems running fast. :)

Video tutorials : https://www.youtube.com/channel/UCCTfZwaRCaPJ_270Z5Hh0VA/feed

If you please run a benchmark on it will be nice to see its performance.

Thanks

2014-11-09 19:42:20

guest

How about a 2014 run of the same?!!

2014-11-25 00:17:22

Leave a Comment

Name
Content
Verification
Type the characters you see in the picture above