You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: admin_manual/installation/server_tuning.rst
+47-8Lines changed: 47 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -128,13 +128,31 @@ more processes to run in parallel to handle the requests.
128
128
Enable PHP OPcache
129
129
------------------
130
130
131
-
The `OPcache <https://php.net/manual/en/intro.opcache.php>`_ improves the performance of PHP applications by caching precompiled bytecode. The default OPcache settings are usually sufficient for Nextcloud code to be fully cached. If any cache size limit is reached by more than 90%, the admin panel will show a related warning. Nextcloud strictly requires code comments to be preserved in opcode, which is the default. But in case PHP settings are changed on your system, you may need set the following:
131
+
The `OPcache <https://php.net/manual/en/intro.opcache.php>`_ improves the performance of PHP applications by caching precompiled bytecode.
132
132
133
-
.. code:: ini
133
+
Revalidation
134
+
^^^^^^^^^^^^
134
135
135
-
opcache.save_comments = 1
136
+
OPcache revalidation in PHP handles changes made to PHP application code stored on disk. Code changes occur whenever:
137
+
138
+
- Nextcloud or a Nextcloud app is upgraded
139
+
- a configuration change is made (e.g. ``config.php`` is modified)
136
140
137
-
By default, cached scripts are revalidated on access to ensure that changes on disk take effect after at most ``2`` seconds. Since Nextcloud handles cache revalidation internally when required, the revalidation frequency can be reduced or completely disabled to enhance performance. Note, however, that it affects manual changes to scripts, including ``config.php``. To check for changes at most every ``60`` seconds, use the following setting:
141
+
Nextcloud, as much as possible, handles cache revalidation internally when required. However this is not foolproof. In a default PHP environment, revalidation is
142
+
enabled and cached scripts are revalidated to ensure that changes (on disk) take effect every ``2`` seconds. In many environments, these default
143
+
values are reasonable (and may never need to be changed).
144
+
145
+
However, the revalidation frequency can be adjusted and may *potentially* enhance performance. We make no recommendations here about appropriate values for revalidation (other than the PHP defaults).
146
+
147
+
.. danger::
148
+
Lengthening the time between revalidation (or disabling it completely) means that manual changes to scripts, including ``config.php``, will take longer before they become active (or will never do so, if
149
+
revalidation is disabled completely). Lengthening also increases the likelihood of transient Server and application upgrade problems. It also prevents the proper toggling of maintenance mode.
150
+
151
+
.. warning::
152
+
If you adjust these parameters, you are more likely to need to restart/reload your web server (mod_php) or fpm after making configuration changes or performing upgrades. If you forget to do so, you
153
+
will likely experience unusual behavior due to a mismatch between what is on disk and is in memory. These may appear to be bugs, but will go away as soon as you restart/reload mod_php/fpm.
154
+
155
+
To change the default from ``2`` and check for changes on disk at most every ``60`` seconds, use the following setting:
138
156
139
157
.. code:: ini
140
158
@@ -146,9 +164,30 @@ To disable the revalidation completely:
146
164
147
165
opcache.validate_timestamps = 0
148
166
149
-
Any change to ``config.php`` will then require either restarting PHP, manually clearing the cache, or invalidating this particular script.
167
+
Any Server/app upgrades or changes to ``config.php`` will then require restarting PHP (or otherwise manually clearing the cache or invalidating this particular script).
168
+
169
+
.. warning::
170
+
To avoid false reports, if your environment isn't using the PHP default revalidation values, please do not report bugs/odd behavior after upgrading Nextcloud or Nextcloud apps until after you've
171
+
restarted mod_php/fpm (to confirm they are not simply caused by local revalidation configuration).
172
+
173
+
Sizing
174
+
^^^^^^
175
+
176
+
If any cache size limit is reached by more than 90%, the admin panel will show a related warning and suggested changes.
177
+
178
+
For more details check out the `official PHP documentation <https://php.net/manual/en/opcache.configuration.php>`_. To monitor OPcache usage, clear individual or all cache entries, `opcache-gui <https://github.com/amnuts/opcache-gui>`_ can be used.
179
+
180
+
Comments
181
+
^^^^^^^^
182
+
183
+
Nextcloud strictly requires code comments to be preserved in opcode, which is the default. But in case PHP settings are changed on your system, you may need set the following:
184
+
185
+
.. code:: ini
186
+
187
+
opcache.save_comments = 1
150
188
151
-
For more details check out the `official documentation <https://php.net/manual/en/opcache.configuration.php>`_. To monitor OPcache usage, clear individual or all cache entries, `opcache-gui <https://github.com/amnuts/opcache-gui>`_ can be used.
189
+
JIT
190
+
^^^
152
191
153
192
PHP 8.0 and above ship with a JIT compiler that can be enabled to benefit any CPU intensive apps you might be running. To enable a tracing JIT with all optimizations:
154
193
@@ -202,8 +241,8 @@ Nextcloud to use Imaginary by editing your `config.php`:
202
241
203
242
For large instance, you should follow `Imaginary's scalability recommendation <https://github.com/h2non/imaginary#scalability>`.
204
243
205
-
Settings:
206
-
^^^^^^^^^
244
+
Settings
245
+
^^^^^^^^
207
246
208
247
If you want set the preview format for imaginary.
209
248
You can change between jpeg and webp, the default is jpeg:
0 commit comments