Improve Performance

maritos/magento2-performance-fixes

Description

To improve first request GraphQL performance we can use Composer package maritos/magento2-performance-fixes. (Source code available here)
In general, this package changes the default cache building process, when the cache is empty, it locks all incoming requests and waits until the first request finishes building cache and then all following requests instead of rebuilding cache just use it right away.
So yeah, up to 30% speed improvements for GraphQL requests on the first load from a thin air.

Installation

Install Composer package

Install Composer package in your project.
1
npm run cli # open CLI
2
3
c require maritos/magento2-performance-fixes # install package
Copied!

Extend composer.json

Add extra field in composer.json
composer.json
1
"extra": {
2
"magento-force": "override",
3
"enable-patching": true,
4
"composer-exit-on-patch-failure": true,
5
"patches": {
6
"magento/framework": {
7
"performance fix #1 - vendor/magento/framework/Config/Data.php": "vendor/maritos/magento2-performance-fixes/vendorPatch/magento/framework/Config/Data.patch",
8
"performance fix #2 - vendor/magento/framework/App/ObjectManager/ConfigLoader.patch": "vendor/maritos/magento2-performance-fixes/vendorPatch/magento/framework/App/ObjectManager/ConfigLoader.patch",
9
"performance fix #3 - vendor/magento/framework/Interception/Config/Config.patch": "vendor/maritos/magento2-performance-fixes/vendorPatch/magento/framework/Interception/Config/Config.patch"
10
}
11
}
12
}
Copied!

Run composer install

After composer install make sure patches have been applied. Composer install output should be similar to:
1
- Applying patches for magento/framework
2
vendor/maritos/magento2-performance-fixes/vendorPatch/magento/framework/Config/Data.patch (performance fix #1 - vendor/magento/framework/Config/Data.php)
3
vendor/maritos/magento2-performance-fixes/vendorPatch/magento/framework/App/ObjectManager/ConfigLoader.patch (performance fix #2 - vendor/magento/framework/App/ObjectManager/ConfigLoader.patch)
4
vendorPatch/magento/framework/Interception/Config/Config.patch (performance fix #3 - vendor/magento/framework/Interception/Config/Config.patch)
Copied!
That's it! Happy coding!
Last modified 4mo ago