Yii preformance
#1
Posted 06 May 2010 - 10:43 AM
#3
Posted 06 May 2010 - 05:14 PM
PoL, on 06 May 2010 - 10:49 AM, said:
Yap I read it before but an old Persian expression say "a dairy never say it's yogurt is sour!" when you see some exaltation it's a bit hard to believe all of them is true. I need some practical tests not just a hello word benchmarking actually it says nothing about the performance if you really want to compare you should write hole a project with two different framework and then running your benchmarking.
#4
Posted 07 May 2010 - 02:09 AM
Using a framework always comes with a tradeoff compared to "pure" PHP. That's the price you have to pay, but you get better organized code and have ready-to-use solutions for common web app problems. Still i recommend you to give Yii a try: It tries to stay very slim and only loads what's really required for handling a request. You can make it stay out of the way if you want to handle some specific action solely with your custom code.
So if you're like me and like the freedom to do whatever you want in PHP but still having the option to use prepared components (which are coded mostly excellent btw.), Yii is perfect for you.
#5
Posted 07 May 2010 - 07:52 AM
Things you should checkout or think about:
a ) Is it possible to write C(++) code and use it in the framework
B ) How quick could I write plugins, extension? (For example RoR is a pain imho)
c ) How good is the cache management and usage? Is it easy to extend? Modify? Test? And how fast is it?
I could not help on a) cause I dont wrote any C++ code for yii
B ) Yii is one of the best,if not THE best framework to extend. I dont found any framework so far with such a good API, API hooks and events, as Yii
c ) Yii has a quit impressive cache management system, cause it loads just "what" is needed and is easy to extend ot change (even the cache backend)
Well, another good framework is Grails, its amazingly close to RoR, but i compiles to Java, which gives some extra boost (Not as fast as pure java code) but its close to it.
Well, if you want to check out new "ways" you should checkout LUA, if you are in a "geeky" mood, or even the lisp webframework (forgot its name)
United-Regions-OFP
A social development project ( In development ;-) )
----------------------------------------------------
#6
Posted 08 May 2010 - 08:19 AM
I have a really good support on Server for unlimited cache services but my agreement with client is based on the best performance as possible to reduce the price of servers and so on.
my client suggest to run some practical tests to get in hand a real benchmarking on Framework vs. PHP hard code to deal with this bottleneck. anyway I do my best to reduce database size and fully implementation of any kind of cache services. and I release the result here to be a good source for whom faced with this question and situation. and I think it cost to test Yii on a practical high traffic web site.
#7
Posted 09 May 2010 - 05:11 AM
So should it be written, so should it be done?
If you really need the best speed, you must write your own code. And you will end on a "micro" framework. Something like fatfree or mimvic. Which just adds MVC to your code (or it will be horrible to extend and modify) and add a database layer to it which makes some common database calls, like getting and checking user logins.
At sum it is something like:
Maintainable <-> Speed comparison of code.
Another things you could checkout are other PHP server programs, for example nginx or cherokee. But they have a drawback compared to apache. Apache integrates PHP on load, while the rest runs over fcgi. This means a new instance on every call. But on static pages this dosnt matter but on hundreds of servers... But this will be fixed in a future version of php which will integrates a new way for fcgi calls, and handling. If you have time until this version of php will be released, it is something to wait for
United-Regions-OFP
A social development project ( In development ;-) )
----------------------------------------------------
#8
Posted 09 May 2010 - 04:21 PM
database has been generated bycode below.
<?php
/**
* @author phpveteran
* @copyright 2010
*/
/* Connecting, selecting database */
$db_link = mysql_connect("localhost", "root", "ringsport");
if (!$db_link) {
die("Could not connect: " . mysql_error());
}
mysql_select_db("benchmarking") or die("Could not select database");
set_time_limit(0);
/* Performing SQL query */
for($i=29;$i<50000;$i++){
$base='ABCDEFGHKLMNOPQRSTWXYZabcdefghjkmnpqrstwxyz123456789';
$max=strlen($base)-1;
mt_srand((double)microtime()*1000000);
$rand_text='';
while (strlen($rand_text)<251)
$rand_text.=$base{mt_rand(0,$max)};
$query = "INSERT INTO `benchmarking`.`text_var` (
`id` ,
`random_var` ,
`random_text`
)VALUES (
NULL , '$rand_text', '$rand_text');";
mysql_query($query);
}
/* Closing connection */
mysql_close($db_link);
?>Raw PHP:
<?php
/**
* @author phpveteran
* @copyright 2010
*/
/* Connecting, selecting database */
$db_link = mysql_connect("localhost", "root", "ringsport");
if (!$db_link) {
die("Could not connect: " . mysql_error());
}
mysql_select_db("benchmarking") or die("Could not select database");
set_time_limit(0);
/* Performing SQL query */
$query = "SELECT * FROM `text_var` WHERE `random_var` = '6CEM3cjkRSg8gLgDSMSyQHwSCeNaPrRhKPMFShQYSFygqZhwY4NWpweEENCSxMghMqfOB9K2tQ6kNCfEnqtaSTMMKdnEhwfQfKnsnBQr2ZATE1ARcKLbfT417tpHDQ4hPe3jScMZHZEpLpn8sMs8QDPSyWkQNjWqqCLGtn3sAkKD1fSbk14TamcKEHn5c2txDEEaswwtQKLfQKgmfXEp3nwq8HMNYxTSkDSY3ZBRMhKNb55H1tM2zcG8Za'";
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)) {
var_dump($row);
}
/* Closing connection */
//mysql_close($db_link);
?>Yii clean and fresh setup SiteController.php and actionIndex
public function actionIndex()
{
// renders the view file 'protected/views/site/index.php'
// using the default layout 'protected/views/layouts/main.php'
//$this->render('index');
$connection=new CDbConnection('mysql:host=localhost;dbname=benchmarking','root','ringsport');
$connection->active=true;
$dataReader = $connection->createCommand("SELECT * FROM `text_var` WHERE `random_var` = '6CEM3cjkRSg8gLgDSMSyQHwSCeNaPrRhKPMFShQYSFygqZhwY4NWpweEENCSxMghMqfOB9K2tQ6kNCfEnqtaSTMMKdnEhwfQfKnsnBQr2ZATE1ARcKLbfT417tpHDQ4hPe3jScMZHZEpLpn8sMs8QDPSyWkQNjWqqCLGtn3sAkKD1fSbk14TamcKEHn5c2txDEEaswwtQKLfQKgmfXEp3nwq8HMNYxTSkDSY3ZBRMhKNb55H1tM2zcG8Za'")->query();
while($row=$dataReader->read()){
var_dump($row);
}
exit;
}Zend framework fresh and clean IndexController.php indexAction
public function indexAction()
{
// action body
set_time_limit(0);
require_once 'Zend/Db.php';
$db = Zend_Db::factory('Mysqli',
array(
'host' => 'localhost',
'dbname' => 'benchmarking',
'username'=> 'root',
'password' => 'ringsport')
);
$stmt = $db->query("SELECT * FROM `text_var` WHERE `random_var` = '6CEM3cjkRSg8gLgDSMSyQHwSCeNaPrRhKPMFShQYSFygqZhwY4NWpweEENCSxMghMqfOB9K2tQ6kNCfEnqtaSTMMKdnEhwfQfKnsnBQr2ZATE1ARcKLbfT417tpHDQ4hPe3jScMZHZEpLpn8sMs8QDPSyWkQNjWqqCLGtn3sAkKD1fSbk14TamcKEHn5c2txDEEaswwtQKLfQKgmfXEp3nwq8HMNYxTSkDSY3ZBRMhKNb55H1tM2zcG8Za'");
$stmt->execute();
while ($data = $stmt->fetchAll()) {
var_dump($data);
}
exit;
}now bench marking result:
Raw PHP:
C:\xampp\apache\bin>ab -t 20 -c 4 http://localhost/random_text/index.php
Benchmarking localhost (be patient)
Finished 125 requests
Concurrency Level: 4
Time taken for tests: 20.585 seconds
Complete requests: 125
Failed requests: 0
Write errors: 0
Total transferred: 155575 bytes
HTML transferred: 117856 bytes
Requests per second: 6.07 [#/sec] (mean)
Time per request: 658.726 [ms] (mean)
Time per request: 164.681 [ms] (mean, across all concurrent requests)
Transfer rate: 7.38 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.4 0 1
Processing: 596 642 58.2 632 878
Waiting: 596 642 58.1 631 877
Total: 596 643 58.2 632 878
Percentage of the requests served within a certain time (ms)
50% 632
66% 634
75% 654
80% 678
90% 711
95% 745
98% 877
99% 878
100% 878 (longest request)
Yii Framework
C:\xampp\apache\bin>ab -t 20 -c 4 http://yii.local/index.php
Benchmarking yii.local (be patient)
Finished 109 requests
Concurrency Level: 4
Time taken for tests: 20.322 seconds
Complete requests: 109
Failed requests: 0
Write errors: 0
Total transferred: 133525 bytes
HTML transferred: 101152 bytes
Requests per second: 5.36 [#/sec] (mean)
Time per request: 745.767 [ms] (mean)
Time per request: 186.442 [ms] (mean, across all concurrent requests)
Transfer rate: 6.42 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.4 0 1
Processing: 630 728 104.4 709 1047
Waiting: 630 727 104.3 709 1047
Total: 630 728 104.4 709 1047
Percentage of the requests served within a certain time (ms)
50% 708
66% 730
75% 777
80% 822
90% 888
95% 955
98% 1047
99% 1047
100% 1047 (longest request)Zend Framework
C:\xampp\apache\bin>ab -t 20 -c 4 http://zf.local/index.php
Benchmarking zf.local (be patient)
Finished 49 requests
Concurrency Level: 4
Time taken for tests: 20.722 seconds
Complete requests: 49
Failed requests: 0
Write errors: 0
Total transferred: 64821 bytes
HTML transferred: 49674 bytes
Requests per second: 2.36 [#/sec] (mean)
Time per request: 1691.607 [ms] (mean)
Time per request: 422.902 [ms] (mean, across all concurrent requests)
Transfer rate: 3.05 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.3 0 1
Processing: 1299 1608 230.1 1599 2091
Waiting: 1298 1607 230.0 1598 2089
Total: 1299 1608 230.1 1600 2091
Percentage of the requests served within a certain time (ms)
50% 1534
66% 1679
75% 1733
80% 1754
90% 1910
95% 2090
98% 2091
99% 2091
100% 2091 (longest request)
#9
Posted 01 June 2010 - 06:47 AM
http://symfony-reloaded.org/fastso you can see that yii have a nice performance.
maybe symfony 2.0 is faster but anywhere symfony 2.0 is still under development.
in this test http://www.yiiframew...om/performance/ i cant believe that
prado is faster then symfony
#10
Posted 01 June 2010 - 06:56 AM
james2010, on 01 June 2010 - 06:47 AM, said:
http://symfony-reloaded.org/fastso you can see that yii have a nice performance.
maybe symfony 2.0 is faster but anywhere symfony 2.0 is still under development.
in this test http://www.yiiframew...om/performance/ i cant believe that
prado is faster then symfony
here is something I should mention symfony benchmarking seems fishy and comparison is not fare enough to make a decision. it's because symfony used router cache by default that can have a serious bottleneck on high request for any other frameworks I totally refuse any benchmarking on just running the damn hello word! it shows nothing
#11
Posted 01 June 2010 - 07:21 AM
http://symfony-reloaded.org/fast there is a product application test as well
#12
Posted 01 June 2010 - 07:30 AM
The fact is that every framework will say: "I'm the faster", or "I'm in the fastest framewroks"
This doesn't matter...
@all_of_you
If the only concern for you to chose one framwork over another is if it is "the fastest", then compare those frameworks yourself with test that are good for you and choose based on these tests!
As already somebody in this forum says, a framework in not only how fast it is, but how simplifies your life in every aspect of programing cicle!
The problem is communication! Excess of communication!
#13
Posted 01 June 2010 - 09:19 AM
PoL, on 01 June 2010 - 07:30 AM, said:
The fact is that every framework will say: "I'm the faster", or "I'm in the fastest framewroks"
This doesn't matter...
@all_of_you
If the only concern for you to chose one framework over another is if it is "the fastest", then compare those frameworks yourself with test that are good for you and choose based on these tests!
As already somebody in this forum says, a framework in not only how fast it is, but how simplifies your life in every aspect of programing cicle!
if you read through the the treat you will see I asked this for a very special project that should handle high traffic and concurrent users. reasons to choose one framework among the others is not distinguished as you think over there we have a dozen of really good frameworks cack/zend/yii/symfony and so on all of them have a very good architecture, design, documents, forum and so on. so if you want to choose one you should focus on some details like performance / security and something that people like you always said WE DO NOT CHOOSE FRAMEWORKS ONLY FOR PERFORMANCE! yup dude it's deal we should choose frameworks only for some details because all of them are good
#14
Posted 01 June 2010 - 09:32 AM
Quote
, you fall in this:
Quote
Then, DO your own test... and choose bases on these tests...
Don't ask in yii's forum "is yii the best one?" (all here will say "Yes for me").... the same (i think) will happen y you ask in symphony forum "Is symphony the best?" (all of them will say "Yes for me")
So the final desicion is up to you...
You will not rest easy until you do your own tests and see the results...
The problem is communication! Excess of communication!

Help














