Skip to content

[Performance] Document the container.dumper.inline_factories parameter #12819

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 20, 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
46 changes: 46 additions & 0 deletions performance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Symfony Application Checklist
-----------------------------

#. :ref:`Install APCu Polyfill if your server uses APC <performance-install-apcu-polyfill>`
#. :ref:`Dump the service container into a single file <performance-service-container-single-file>`

Production Server Checklist
---------------------------
Expand All @@ -33,6 +34,51 @@ OPcache, install the `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.

.. _performance-service-container-single-file:

Dump the Service Container into a Single File
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. versionadded:: 4.4

The ``container.dumper.inline_factories`` parameter was introduced in
Symfony 4.4.

Symfony compiles the :doc:`service container </service_container>` into multiple
small files by default. Set this parameter to ``true`` to compile the entire
container into a single file, which could improve performance when using
"class preloading" in PHP 7.4 or newer versions:

.. configuration-block::

.. code-block:: yaml

# config/services.yaml
parameters:
# ...
container.dumper.inline_factories: true

.. code-block:: xml

<!-- config/services.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd">

<parameters>
<!-- ... -->
<parameter key="container.dumper.inline_factories">true</parameter>
</parameters>
</container>

.. code-block:: php

// config/services.php

// ...
$container->setParameter('container.dumper.inline_factories', true);

.. _performance-use-opcache:

Use the OPcache Byte Code Cache
Expand Down