-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Improved the main performance article to make it more actionable #7960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I like this a lot 👍 |
👍 nice idea |
I've finished the reorganization of the article. It's ready to review now. When merged, we'll need to make some changes for the latest Symfony versions because some of those practices are no longer recommended. And hopefully we'll add more tips too. Thanks! |
|
||
#. :ref:`Install APCu Polyfill if your server uses APC <performance-install-apcu-polyfill>` | ||
#. :ref:`Enable APC Caching for the Autoloader <performance-autoloader-apc-cache>` | ||
#. :ref:`Use Bootstrap Files <performance-use-bootstrap-files>` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the performance-use-bootstrap-files
label does not seem to exist
The first thing that you should do to improve your performance is to use a | ||
"byte code cache". These caches store the compiled PHP files to avoid having | ||
to recompile them for every request. | ||
Install APCu Polyfill if your server uses APC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your Server Uses
`APCu Polyfill component`_ in your application to enable compatibility with | ||
`APCu PHP functions`_ and unlock support for advanced Symfony features, such | ||
as the APCu Cache adapter. | ||
Enable APC Caching for the Autoloader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not convinced that we should still recommend the ApcClassLoader
anymore. The component will be removed in Symfony 4.0 anyway and you can use Composer to achieve the same. I think we should link to https://getcomposer.org/doc/articles/autoloader-optimization.md instead now that Composer has its own autoloader improvement article.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe mention the commands composer install --apcu-autoloader
and/or composer dump-autoload --apcu
and link for the rest.
(I tried this in #8098)
ApcClassLoader
is deprecated (since 3.3), so I vote against recommending.
|
||
.. note:: | ||
|
||
Even when using a byte code cache, performance will improve when using a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation should use four spaces
in the `autoload.php`_ file. This autoloader is easy to use, as it will | ||
automatically find any new classes that you've placed in the registered | ||
directories. | ||
Use the OPcache byte code cache |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Byte Code Cache
|
||
The class map can be generated from the command line, and might become part of | ||
your deploy process: | ||
Configure OPcache for maximum performance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maximum Performance
|
||
.. code-block:: bash | ||
The default OPcache configuration is not suited for Symfony application, so |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
applications
|
||
// app.php | ||
// ... | ||
Don't check PHP timestamps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
8000The reason will be displayed to describe this comment to others. Learn more.
Check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timestamps
|
||
For more details, see :doc:`/components/class_loader/cache_class_loader`. | ||
; after each deploy, call `opcache_reset()` or restart the web server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably do not restart the web server but the PHP FPM process.
Bootstrap Files and Byte Code Caches | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
The class loader used while developing the application is optimized to find | ||
new and changed classes. In production servers, PHP files should never change, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On production servers [...]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and in this section we should link to the article in the Composer documentation
This PR was merged into the 3.3 branch. Discussion ---------- Remove outdated performance tips I've just realized there is an ongoing effort to rewrite this in #8410 and #7960. But if those are not merged soon, I'd suggest to merge this first so that we can at least solve the broken doc and people don't try to repeatedly fix this, like me and #8332 Commits ------- d21e200 Remove outdated performance tips
Closing it in favor of #9161. |
…onable (javiereguiluz) This PR was squashed before being merged into the 2.7 branch (closes #9161). Discussion ---------- Updated the main performance article to make it more actionable This one finishes and replaces #7960, #8410 and #8332. Commits ------- fa393c5 Updated the main performance article to make it more actionable
The main Performance article is very important: https://symfony.com/doc/current/performance.html
However, the current article is boring and contains too much text. I propose to make it actionable by turning the original contents into checklists that you can quickly verify in your app and your servers.
I share a WIP version of this proposal to ask your opinion about it before finishing it. Thanks!