Skip to content

Commit c66fd5e

Browse files
Some opcache and composer optimizations (#1460)
Co-authored-by: Melroy van den Berg <[email protected]>
1 parent 5a18b74 commit c66fd5e

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156
"ergebnis/composer-normalize": true
157157
},
158158
"optimize-autoloader": true,
159+
"classmap-authoritative": true,
159160
"preferred-install": {
160161
"*": "dist"
161162
},

config/services.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ parameters:
114114
mbin_downvotes_mode: '%env(enum:\App\Utils\DownvotesMode:default:mbin_downvotes_mode_default:MBIN_DOWNVOTES_MODE)%'
115115

116116
mbin_new_users_need_approval: '%env(bool:default::MBIN_NEW_USERS_NEED_APPROVAL)%'
117+
.container.dumper.inline_factories: true
117118

118119
services:
119120
# default configuration for services in *this* file

docker/php/conf.d/app.prod.ini

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,9 @@ opcache.enable_cli=1
88
opcache.memory_consumption=512
99
opcache.interned_strings_buffer=128
1010
opcache.max_accelerated_files=100000
11-
opcache.jit_buffer_size=500M
11+
opcache.validate_timestamps=0
12+
opcache.preload=/var/www/mbin/config/preload.php
13+
opcache.preload_user=www-data
14+
; Enable PHP JIT with all optimizations
15+
opcache.jit = 1255
16+
opcache.jit_buffer_size=500M

docs/02-admin/01-installation/01-bare_metal.md

+8
Original file line numberDiff line numberDiff line change
@@ -270,16 +270,24 @@ Optionally also enable OPCache for improved performances with PHP (recommended f
270270
```ini
271271
opcache.enable = 1
272272
opcache.enable_cli = 1
273+
; replace `/var/www/mbin` with `/var/www/kbin` if needed
274+
opcache.preload = /var/www/mbin/config/preload.php
275+
opcache.preload_user = www-data
273276
; Memory consumption (in MBs), personal preference
274277
opcache.memory_consumption = 512
275278
; Internal string buffer (in MBs), personal preference
276279
opcache.interned_strings_buffer = 128
277280
opcache.max_accelerated_files = 100000
281+
opcache.validate_timestamps = 0
278282
; Enable PHP JIT with all optimizations
279283
opcache.jit = 1255
280284
opcache.jit_buffer_size = 500M
281285
```
282286

287+
> [!CAUTION]
288+
> Be aware that activating `opcache.preload` can lead to errors if you run multiple sites
289+
> (because of re-declaring classes).
290+
283291
More info: [Symfony Performance docs](https://symfony.com/doc/current/performance.html)
284292

285293
Edit your PHP `www.conf` file as well, to increase the amount of PHP child processes (optional):

0 commit comments

Comments
 (0)