Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slow execution of Symfony project locally

I have this problem for quite a long time but it is getting slower and slower to display a simple page of my Symfony 2 project.

This is my development environment:

  • Wampserver 2.2 with PHP 5.3.13, MySQL 5.5.24 and Apache 2.2.22
  • Symfony 2.7
  • Netbeans 8.1

I am really not sure it comes from Symfony though it is more obvious with a symfony project (4-5 minutes to display a page).

Even calling phpmyadmin from the wampserver is long.

No problem with the memory, the CPU or the disk. Using the resources manager to check, everything seems to be fine.

Those are Apache logs. I have kilometers of :

PHP Fatal error: Maximum execution time of 90 seconds exceeded in C:\wamp\www\MyProject\app\cache\dev\classes.php on line 5270, referer: http://localhost/MyProject/web/app_dev.php/myURL?init
[Thu May 12 14:11:28 2016] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://localhost/MyProject/web/app_dev.php/myURL?init
[Thu May 12 14:11:28 2016] [error] [client 127.0.0.1] PHP 1. Monolog\Handler\AbstractHandler->__destruct() C:\wamp\www\MyProject\app\cache\dev\classes.php:0, referer: http://localhost/MyProject/web/app_dev.php/myURL?init
[Thu May 12 14:11:30 2016] [error] [client 127.0.0.1] PHP Fatal error: Maximum execution time of 90 seconds exceeded in C:\wamp\www\MyProject\app\cache\dev\classes.php on line 5270, referer: http://localhost/MyProject/web/app_dev.php/myURL?init [Thu May 12 14:11:30 2016] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://localhost/MyProject/web/app_dev.php/myURL?init [Thu May 12 14:11:30 2016] [error] [client 127.0.0.1] PHP 1. Monolog\Handler\AbstractHandler->__destruct() C:\wamp\www\MyProject\app\cache\dev\classes.php:0, referer: http://localhost/MyProject/web/app_dev.php/myURL?init [Thu May 12 14:11:32 2016] [error] [client 127.0.0.1] PHP Fatal error: Maximum execution time of 90 seconds exceeded in C:\wamp\www\MyProject\app\cache\dev\classes.php on line 5270, referer: http://localhost/MyProject/web/app_dev.php/myURL?init [Thu May 12 14:11:32 2016] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://localhost/MyProject/web/app_dev.php/myURL?init [Thu May 12 14:11:32 2016] [error] [client 127.0.0.1] PHP 1. Monolog\Handler\AbstractHandler->__destruct() C:\wamp\www\MyProject\app\cache\dev\classes.php:0, referer: http://localhost/MyProject/web/app_dev.php/myURL?init [Thu May 12 14:13:04 2016] [error] [client 127.0.0.1] PHP Fatal error: Maximum execution time of 90 seconds exceeded in C:\wamp\www\MyProject\app\cache\dev\classes.php on line 5270, referer: http://localhost/MyProject/web/app_dev.php/myURL?init

Does anybody Have any idea of what i can do... I already reinstalled several time my software but it does not change anything

Thanks for the ideas and any help.

like image 379
mlwacosmos Avatar asked May 12 '16 12:05

mlwacosmos


People also ask

Why is Symfony so slow?

A large user object with lots of properties and associations can slow down your application, because Symfony reloads the user from the database in every request. You can fix this problem by separating the User object Symfony Security needs from the one you are using in your application.


1 Answers

Basing on comments under question, we came to the answer that the main reason is XDebug which usually has significant impact on PHP performance.

You wrote in your command that Symfony's profiler now shows 3-6 seconds, but in practice it takes a lot more. That means, that PHP itself is probably not the only problem.

I would suggest to look into browser's developer tools (Firebug etc, depending on the browser you use) and check timeline in Network tab. Maybe it will give you further information where to look for the reason.

For my local computer it usually takes PHP about a second (on dev env; and depending on cache state and what page is it) to execute Symfony.

like image 51
Jakub Matczak Avatar answered Sep 24 '22 00:09

Jakub Matczak