Skip to content

Commit c1b64cc

Browse files
committed
Further rewordings and improvements
1 parent fab7a0a commit c1b64cc

File tree

1 file changed

+30
-23
lines changed

1 file changed

+30
-23
lines changed

performance.rst

+30-23
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,48 @@ Performance
66

77
Symfony is fast, right out of the box. Of course, if you really need speed,
88
there are many ways that you can make Symfony even faster. In this chapter,
9-
you'll explore many of the most common and powerful ways to make your Symfony
10-
application even faster.
9+
you'll explore some of the ways to make your Symfony application even faster.
1110

1211
.. index::
1312
single: Performance; Byte code cache
1413

1514
Use a Byte Code Cache (e.g. OPcache)
1615
------------------------------------
1716

18-
One of the best (and easiest) things that you should do to improve your performance
19-
is to use a "byte code cache". The idea of a byte code cache is to remove
20-
the need to constantly recompile the PHP source code. There are a number of
21-
`byte code caches`_ available, some of which are open source. As of PHP 5.5,
22-
PHP comes with `OPcache`_ built-in. For older versions, the most widely used
23-
byte code cache is `APC`_.
17+
The first thing that you should do to improve your performance is to use a
18+
"byte code cache". These caches store the compiled PHP files to avoid having
19+
to recompile them for every request.
20+
21+
There are a number of `byte code caches`_ available, some of which are open
22+
source. As of PHP 5.5, PHP comes with `OPcache`_ built-in. For older versions,
23+
the most widely used byte code cache is `APC`_.
2424

2525
Using a byte code cache really has no downside, and Symfony has been architected
2626
to perform really well in this type of environment.
2727

2828
Further Optimizations
2929
~~~~~~~~~~~~~~~~~~~~~
3030

31-
Byte code caches usually monitor the source files for changes. This ensures
32-
that if the source of a file changes, the byte code is recompiled automatically.
33-
This is really convenient, but obviously adds overhead.
31+
Most byte code caches monitor the source files for changes. This ensures that if
32+
the source of a file changes, the byte code is recompiled automatically.
33+
This is really convenient, but it adds overhead.
3434

3535
For this reason, some byte code caches offer an option to disable these checks.
36-
Obviously, when disabling these checks, it will be up to the server admin
37-
to ensure that the cache is cleared whenever any source files change. Otherwise,
38-
the updates you've made won't be seen.
36+
For example, to disable these checks in APC, simply add ``apc.stat=0`` to your
37+
``php.ini`` configuration.
38+
39+
When disabling these checks, it will be up to the server administrators to
40+
ensure that the cache is cleared whenever any source files change. Otherwise,
41+
the updates you've made in the application won't be seen.
3942

40-
For example, to disable these checks in APC, simply add ``apc.stat=0`` to
41-
your ``php.ini`` configuration.
43+
For the same reasons, the byte code cache must also be cleared when deploying
44+
the application (for example by calling ``apc_clear_cache()`` PHP function when
45+
using APC and ``opcache_reset()`` when using OPCache).
4246

4347
.. index::
4448
single: Performance; Autoloader
4549

46-
Configure the PHP realpath cache
50+
Configure the PHP realpath Cache
4751
--------------------------------
4852

4953
PHP uses an internal cache to store the result of mapping file paths to their
@@ -54,7 +58,7 @@ systems.
5458
By default PHP sets a ``realpath_cache_size`` of ``16K`` which is too low for
5559
Symfony. Consider updating this value at least to ``4096K``. In addition, cached
5660
paths are only stored for ``120`` seconds by default. Consider updating this
57-
value too using the ``realpath_cache_ttl`` option in your ``php.ini`` file:
61+
value too using the ``realpath_cache_ttl`` option:
5862

5963
.. code-block:: ini
6064
@@ -85,11 +89,14 @@ your deploy process:
8589
8690
$ composer dump-autoload --optimize --no-dev --classmap-authoritative
8791
88-
The ``--optimize`` option dumps every PSR-0 and PSR-4 compatible class used in
89-
your application. The ``--no-dev`` option excludes the classes that are only
90-
needed in the development environment (e.g. tests). The ``--classmap-authoritative``
91-
option prevents Composer from scanning the file system for classes that are not
92-
found in the class map.
92+
``--optimize``
93+
Dumps every PSR-0 and PSR-4 compatible class used in your application.
94+
``--no-dev``
95+
Excludes the classes that are only needed in the development environment
96+
(e.g. tests).
97+
``--classmap-authoritative``
98+
Prevents Composer from scanning the file system for classes that are not
99+
found in the class map.
93100

94101
Caching the Autoloader with APC
95102
-------------------------------

0 commit comments

Comments
 (0)