Not so long ago I got acquainted with the tool for creating a virtual environment Vagrant, which I use for web development and I am very happy about it. But not everything is so joyful with the implementation of the Symfony2 project in this environment. Namely, the problem is in the slowness of loading (generating) the page! So there was a task to increase the speed, since the page load time is more than 10 seconds, well, not so hot.
Who had the same problem, or who just wondered please under the cat.
Having walked around the Internet, I found a wonderful
article about how updates of the cache and logs in the Symfony2 project affect performance. The author, using
XHProf, found “bottlenecks” and describing all the details, came to the conclusion that updating the cache and logs in a shared directory leads to the problem of slow page generation and the solution to this problem is to override these directories by transferring them from shared to some another in the virtual OS. And exactly like this:
<?php class AppKernel extends Kernel {
')
Having done this, I missed the page load time but it still remained great. The server's response was already shorter, but loading the asset files took about 7-9 seconds, so I took another tip from the above article and ran the command to automatically generate and regenerate the assets:
$ php app/console assetic:dump --watch
before this, disable their automatic updates on every request:
# app/config/config_dev.yml assetic: use_controller: false
More about this can be found here
Dumping Asset Files in the dev environmentAs a result, after carrying out just two simple actions, I managed to speed up the page loading time from more than 10 to less than 1 second, depending on the particular page, which accordingly allowed me to increase the development time and debagging in the virtual Vagrant environment.