Answer the question
In order to leave comments, you need to log in
What is the performance of yii2 and laravel?
Hello. Decided to study web programming. Since I am the owner of cubieboard2, I raised the lamp server and decided to study php. Wordpress renders a page on it in 3-5 seconds, so I decided to study something more lightweight.
At first I tried yii2, everything seems to be fine. Since lately cries about laravel have been heard from everywhere, I decided to try it. I liked it more, all sorts of goodies from the box. Yes, and there are more examples / ready-made solutions for him at the moment. I downloaded the starter project and ran it.
The performance really surprised me. Generating a simple page without accessing the database 1.5-2 seconds. Using this caching method, I got performance in the region of 1 second per request. Then I tried an empty project
composer create-project laravel/laravel your-project-name --prefer-dist
300 milliseconds to get an empty view. Caching by the same method gives no visible results at all. The server keeps around 12 requests per second. $key = 'ContentController-actionIndex';
$value = Yii::$app->cache->get($key);
if ($value === false)
{
$searchModel = new ContentSearch;
$dataProvider = $searchModel->search(Yii::$app->request->getQueryParams());
$value = $this->render('index', [
'dataProvider' => $dataProvider,
'searchModel' => $searchModel,
]);
Yii::$app->cache->set($key, $value, 1000);
}
return $value;
Answer the question
In order to leave comments, you need to log in
I will answer my problem. Maybe someone will come in handy.
Delivered in VirtualBox Ubuntu Server. I gave him 1 core of my i7 and 1 gigabyte of RAM.
The server calmly withstands 40 or more requests per second (I couldn’t do more because I couldn’t set up Apache for stable operation, every 30 seconds there was a delay peak and the return time graph went astray, which interfered with observation). As a result of a couple of days of testing, I came to the conclusion that yii2 incurs less overhead.
With 40 requests, yii2 for its basic template renders a page in 7.5-10 milliseconds (CPU usage jumps within 20-30%). An empty Laravel project with HomeController and 1 view renders a page in 10-15 milliseconds (CPU usage fluctuates within 30-40%). At the same time, even with caching and sessions configured (for not using hdd - apc driver), there is a use of hdd, which causes problems in the case of a Linux server on an SD card.
Lavarel requires 1.5-2 times more time to execute the simplest scenario - requesting 1 method with the return of the simplest view.
The resulting statistics are most likely completely unimportant for regular servers, but in my case it does not speak in favor of Laravel.
Yii can speed up turning off log and setting up another cache adapter.
Laravel suffers from the same garbage, the log cache adapter. session on cookies to change should add speed.
I really love Yii2 and like it more with every commit, I use it in my personal projects.
I use Laravel at work and for a number of projects that need to be supported. + It is easier for the team when there is no zoo of frameworks.
Here is another piece of the official guide on the topic: www.yiiframework.com/doc-2.0/guide-performance.html
Heh, you're funny
The fact that you can't cook something doesn't mean it's slow
www.webpagetest.org/result/140620_HV_E8S
the first byte after 141 milliseconds
141 milliseconds is monstrously slow for a simple page.
I chose laravel because it responds within 50ms.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question