Yii 1.0.7 very poor performance with PHP 5.2.10

I started using Yii at 1.0.3 when I saw it was performing very well. But now release 1.0.7 seems very slow. Is it a known problem?

Here is my benchmark on Apache 2.2.11, PHP 5.2.10, using ab -n 5000 -c 10, and a very simple hello world application with no database or anything extra:

1.0.3 Requests per second:    415.78 [#/sec] (mean)

1.0.4 Requests per second:    410.97 [#/sec] (mean)

1.0.5 Requests per second:    412.09 [#/sec] (mean)

1.0.6 Requests per second:    406.08 [#/sec] (mean)

1.0.7 Requests per second:    83.25 [#/sec] (mean)

On the same server, plain PHP scripts run at 3719.03 [#/sec] (mean).

That's not likely because 1.0.7 didn't introduce any change to execution path involved in running the hello world demo…

Did you turn on APC?

Did you shutdown and restart apache before running "ab" with 1.0.7?

I see the same problem, after some profiling with xdebug I see that a strange problem occur with PHP/APC, all the framework is excluded from APC opcode cache in 1.0.7

APC stats for 1.0.7:

<hidden>/index.php 500 7892 2009/07/13 03:27:21 2009/07/13 00:23:53 2009/07/13 03:23:09  

<hidden>/SiteController.php 500 12404 2009/07/13 03:27:21 2009/07/13 02:47:26 2009/07/13 03:23:09

<hidden>/main.php 500 2573 2009/07/13 03:27:21 2009/07/13 00:23:53 2009/07/13 03:23:09

<hidden>/index.php 500 2106 2009/07/13 03:27:21 2009/07/13 02:46:27 2009/07/13 03:23:09

<hidden>/main.php 499 6891 2009/07/13 03:27:21 2009/07/13 00:23:53 2009/07/13 03:23:09

<hidden>/mainMenu.php 499 2559 2009/07/13 03:27:21 2009/07/13 00:23:53 2009/07/13 03:23:09

<hidden>/MainMenu.php 499 13916 2009/07/13 03:27:21 2009/07/13 00:23:53 2009/07/13 03:23:09

<hidden>/YiiBase.php 499 89351 2009/07/13 03:27:21 2009/07/13 03:23:01 2009/07/13 03:23:09

APC stat with 1.0.5 :

<hidden>/index.php 499 7892 2009/07/13 03:28:22 2009/07/13 00:23:53 2009/07/13 03:28:21  

<hidden>/main.php 499 6891 2009/07/13 03:28:22 2009/07/13 00:23:53 2009/07/13 03:28:21

<hidden>/SiteController.php 499 12404 2009/07/13 03:28:22 2009/07/13 02:47:26 2009/07/13 03:28:21

<hidden>/main.php 499 2573 2009/07/13 03:28:22 2009/07/13 00:23:53 2009/07/13 03:28:21

<hidden>/index.php 499 2106 2009/07/13 03:28:22 2009/07/13 02:46:27 2009/07/13 03:28:21

<hidden>/yii.php 499 2053 2009/07/13 03:28:22 2008/05/03 04:09:45 2009/07/13 03:28:21

<hidden>/CClientScript.php 499 90424 2009/07/13 03:28:22 2008/05/03 04:09:45 2009/07/13 03:28:21

<hidden>/CLogRouter.php 499 11012 2009/07/13 03:28:22 2008/05/03 04:09:32 2009/07/13 03:28:21

<hidden>/CLogRoute.php 499 8420 2009/07/13 03:28:22 2008/05/03 04:09:32 2009/07/13 03:28:21

<hidden>/CFileLogRoute.php 499 21930 2009/07/13 03:28:22 2008/05/03 04:09:32 2009/07/13 03:28:21

<hidden>/interfaces.php 499 56680 2009/07/13 03:28:22 2008/05/03 04:09:41 2009/07/13 03:28:21

<hidden>/CApplicationComponent.php 499 4890 2009/07/13 03:28:22 2008/05/03 04:09:41 2009/07/13 03:28:21

<hidden>/YiiBase.php 499 83579 2009/07/13 03:28:22 2009/07/13 03:22:48 2009/07/13 03:28:21

<hidden>/MainMenu.php 498 13916 2009/07/13 03:28:22 2009/07/13 00:23:53 2009/07/13 03:28:21

<hidden>/CWidget.php 498 22994 2009/07/13 03:28:22 2008/05/03 04:09:43 2009/07/13 03:28:21

<hidden>/CHtml.php 498 267797 2009/07/13 03:28:22 2008/05/03 04:09:43 2009/07/13 03:28:21

<hidden>/CWebUser.php 498 77572 2009/07/13 03:28:22 2008/05/03 04:09:42 2009/07/13 03:28:21

<hidden>/CInlineAction.php 498 2981 2009/07/13 03:28:22 2008/05/03 04:09:42 2009/07/13 03:28:21

<hidden>/CAction.php 498 4798 2009/07/13 03:28:22 2008/05/03 04:09:42 2009/07/13 03:28:21

<hidden>/CWebApplication.php 498 78402 2009/07/13 03:28:22 2008/05/03 04:09:45 2009/07/13 03:28:21

<hidden>/CUrlManager.php 498 84208 2009/07/13 03:28:22 2008/05/03 04:09:45 2009/07/13 03:28:21

<hidden>/CHttpSession.php 498 55111 2009/07/13 03:28:22 2008/05/03 04:09:45 2009/07/13 03:28:21

<hidden>/CHttpRequest.php 498 119575 2009/07/13 03:28:22 2008/05/03 04:09:45 2009/07/13 03:28:21

<hidden>/CController.php 498 142264 2009/07/13 03:28:22 2008/05/03 04:09:45 2009/07/13 03:28:21

<hidden>/CBaseController.php 498 30930 2009/07/13 03:28:22 2008/05/03 04:09:45 2009/07/13 03:28:21

<hidden>/CLogger.php 498 24170 2009/07/13 03:28:22 2008/05/03 04:09:32 2009/07/13 03:28:21

<hidden>/CMap.php 498 39042 2009/07/13 03:28:22 2008/05/03 04:09:45 2009/07/13 03:28:21

<hidden>/CListIterator.php 498 7663 2009/07/13 03:28:22 2008/05/03 04:09:45 2009/07/13 03:28:21

<hidden>/CList.php 498 43166 2009/07/13 03:28:22 2008/05/03 04:09:45 2009/07/13 03:28:21

<hidden>/CAttributeCollection.php 498 21014 2009/07/13 03:28:22 2008/05/03 04:09:45 2009/07/13 03:28:21

<hidden>/CComponent.php 498 78588 2009/07/13 03:28:22 2008/05/03 04:09:41 2009/07/13 03:28:21

<hidden>/CApplication.php 498 84704 2009/07/13 03:28:22 2008/05/03 04:09:41 2009/07/13 03:28:21

<hidden>/mainMenu.php 497 2559 2009/07/13 03:28:22 2009/07/13 00:23:53 2009/07/13 03:28:21

<hidden>/CModule.php 496 61740 2009/07/13 03:28:22 2008/05/03 04:09:41 2009/07/13 03:28:21

Wow, the strangest bug in my PHP life…

The bug is that all the file in the 1.0.7 release are year 2020!! and PHP/APC don't cache it!

The fix : find . -exec touch {} ;

ah, yes, thank you for the finding!

Is it fixed in latest downloadable package?

Nope, it's not fixed. We will fix it in the next release.

Thank you PatriceG! I touched the files and now 1.0.7 performs about the same as 1.0.6.

I was worried for a while because Zend Framework (which we are using at work for commercial projects) has been slowing down since its first release. I would not like to see that happen to Yii.

At the moment, my personal testing shows that Yii ranks between CodeIgniter and ZF for similar helloworld apps: (http://flk.cc/e3)

CodeIgniter 1.7.1: 666.14 req/s

Yii Framework 1.0.7: 400.78 req/s

Zend Framework 1.8.4: 132.93 req/s

(I don't like CI's architecture and it doesn't have all features I need.)

Your diagram has frustrated me a bit… I thought I use the most highly performanced PHP framework. Have you done it before or after this bug fix?

Yii is the most highly performanced PHP framework with the features it have. No framework approach or CI (if compared without caching) is faster.

thx :D

My personal test with phpmark on Ubuntu 8.04 without caching

Yii 1.0.7 = 100.69 [req/sec]

CodeIgniter 1.7.1 = 136.98 [req/sec]