Skip to content

Commit

Permalink
Update overlapping optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
Isengo1989 committed Dec 20, 2024
1 parent ac32c79 commit 54fd41e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions guides/hosting/performance/performance-tweaks.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,12 @@ Keep in mind that pre-rendering puts extra load on your server and also can affe

## Optimize class loading

PHP loads many classes on each request which can be a performance bottleneck. To optimize this, make sure `opcache.max_accelerated_files` is set to `20000` or higher.
### opcache.max_accelerated_files

PHP loads many classes on each request, which can be a performance bottleneck. To optimize this, make sure `opcache.max_accelerated_files` is set to `20000` or higher.

### classmap-authoritative

Additionally, when all plugins are installed directly through Composer and managed by Composer, you can generate a static autoloader which does no class mapping at runtime.

To enable this, set the following configuration in your `composer.json`:
Expand All @@ -324,11 +329,14 @@ To enable this, set the following configuration in your `composer.json`:
},
"optimize-autoloader": true,
+ "classmap-authoritative": true,
+ "apcu-autoloader": true,
"sort-packages": true
},
```

For more information, check out the [Composer documentation](https://getcomposer.org/doc/articles/autoloader-optimization.md#optimization-level-2-a-authoritative-class-maps).

### opcache.preload

Check warning on line 338 in guides/hosting/performance/performance-tweaks.md

View workflow job for this annotation

GitHub Actions / LanguageTool

[LanguageTool] guides/hosting/performance/performance-tweaks.md#L338

If a new sentence starts here, add a space and start with an uppercase letter. (LC_AFTER_PERIOD[1]) Suggestions: ` Preload`, ` preload` Rule: https://community.languagetool.org/rule/show/LC_AFTER_PERIOD?lang=en-US&subId=1 Category: CASING
Raw output
guides/hosting/performance/performance-tweaks.md:338:12: If a new sentence starts here, add a space and start with an uppercase letter. (LC_AFTER_PERIOD[1])
 Suggestions: ` Preload`, ` preload`
 Rule: https://community.languagetool.org/rule/show/LC_AFTER_PERIOD?lang=en-US&subId=1
 Category: CASING

To completely reduce the class loading at runtime, you can enable `opcache.preload` by setting it to `<project-root>/var/cache/opcache-preload.php` and `opcache.preload_user` to the user running the PHP process. This will preload all classes into the opcache on PHP-FPM startup and reduce the class loading at runtime.

::: warning
Expand Down

0 comments on commit 54fd41e

Please sign in to comment.