Skip to content

Mentioned the PHP 7.4 class preloading #12761

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

Merged
merged 1 commit into from
Dec 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions performance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Production Server Checklist
---------------------------

#. :ref:`Use the OPcache byte code cache <performance-use-opcache>`
#. :ref:`Use the OPcache class preloading <performance-use-preloading>`
#. :ref:`Configure OPcache for maximum performance <performance-configure-opcache>`
#. :ref:`Don't check PHP files timestamps <performance-dont-check-timestamps>`
#. :ref:`Configure the PHP realpath Cache <performance-configure-realpath-cache>`
Expand All @@ -42,6 +43,28 @@ every request. There are some `byte code caches`_ available, but as of PHP
5.5, PHP comes with `OPcache`_ built-in. For older versions, the most widely
used byte code cache is `APC`_.

.. _performance-use-preloading:

Use the OPcache class preloading
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. versionadded:: 4.4

The feature that generates the preloading file was introduced in Symfony 4.4.

Starting from PHP 7.4, OPcache can compile and load classes at start-up and
make them available to all requests until the server is restarted, improving
performance significantly.

Symfony generates the file automatically with the list of classes to preload.
The file path is the same as the file generated for the service container but
with the ``preload`` suffix:

.. code-block:: ini

; php.ini
opcache.preload=/path/to/project/var/cache/prod/App_KernelProdContainer.preload.php

.. _performance-configure-opcache:

Configure OPcache for Maximum Performance
Expand Down