8000 Improved the main performance article to make it more actionable by javiereguiluz · Pull Request #7960 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

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

Closed
wants to merge 4 commits into from

Conversation

javiereguiluz
Copy link
Member

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!

@javiereguiluz
Copy link
Member Author

This is how this idea would look like in action:

performance-checklist

@weaverryan
Copy link
Member

I like this a lot 👍

@xabbuh
Copy link
Member
xabbuh commented May 31, 2017

👍 nice idea

@javiereguiluz
Copy link
Member Author

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>`
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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.

Copy link
Contributor

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

8000

The reason will be displayed to describe this comment to others. Learn more.

Check

Copy link
Member

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
Copy link
Member

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On production servers [...]

Copy link
Member

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

@HeahDude HeahDude added this to the 2.7 milestone Jul 29, 2017
weaverryan added a commit that referenced this pull request Oct 29, 2017
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
@javiereguiluz
Copy link
Member Author

Closing it in favor of #9161.

javiereguiluz added a commit that referenced this pull request Jan 30, 2018
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0