# Improve Performance

## Update to the latest magento-scripts

In **magento-scripts** version **2.4.0,** page load time was reduced significantly. Due to this improvement, Varnish was disabled **by default**.

{% content-ref url="../getting-started/updating-to-new-releases" %}
[updating-to-new-releases](https://docs.create-magento-app.com/getting-started/updating-to-new-releases)
{% endcontent-ref %}

## Enabling VirtioFS in Docker Desktop on Mac

{% hint style="warning" %}
You must have the following version of macOS in order for this feature to work:

* macOS 12.2 and above (for Apple Silicon)
* macOS 12.3 and above (for Intel)
  {% endhint %}

For the best experience on macOS, it is recommended to enable VirtioFS in the **Docker Desktop** settings > **General** > **Choose file sharing implementation for your containers**.

<figure><img src="https://1705439005-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MOVnS5lKxiIvOL9no4d%2Fuploads%2FV2untElWGH2IFSFYl7ac%2FScreenshot%202025-05-13%20at%2015.33.38.png?alt=media&#x26;token=bbce750d-424e-4764-a5e6-fa5c69fdf272" alt=""><figcaption></figcaption></figure>

See the [blog post from the Docker team introducing VirtioFS](https://www.docker.com/blog/speed-boost-achievement-unlocked-on-docker-desktop-4-6-for-mac/).

{% hint style="warning" %}
At the time of writing, Docker VMM is in Beta and does not work stably in our testing. If you experience installation issues on Composer 2.8 or newer try updating PHP container images to the latest version by running [start with pull-images option](https://docs.create-magento-app.com/getting-started/available-commands/start#pull-images)!&#x20;
{% endhint %}

## maritos/magento2-performance-fixes

### Description

To improve first request GraphQL performance we can use Composer package [maritos/magento2-performance-fixes](https://libraries.io/packagist/maritos%2Fmagento2-performance-fixes). (Source code available [here](https://github.com/maritos/magento2-performance-fixes))

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.

```bash
npm run cli # open CLI

c require maritos/magento2-performance-fixes # install package
```

#### Extend composer.json

Add `extra` field in `composer.json`

{% code title="composer.json" %}

```javascript
"extra": {
    "magento-force": "override",
    "enable-patching": true,
    "composer-exit-on-patch-failure": true,
    "patches": {
        "magento/framework": {
            "performance fix #1 - vendor/magento/framework/Config/Data.php": "vendor/maritos/magento2-performance-fixes/vendorPatch/magento/framework/Config/Data.patch",
            "performance fix #2 - vendor/magento/framework/App/ObjectManager/ConfigLoader.patch": "vendor/maritos/magento2-performance-fixes/vendorPatch/magento/framework/App/ObjectManager/ConfigLoader.patch",
            "performance fix #3 - vendor/magento/framework/Interception/Config/Config.patch": "vendor/maritos/magento2-performance-fixes/vendorPatch/magento/framework/Interception/Config/Config.patch"
        }
    }
}
```

{% endcode %}

#### Run composer install

After `composer install` make sure patches have been applied.\
Composer install output should be similar to:

```javascript
  - Applying patches for magento/framework
    vendor/maritos/magento2-performance-fixes/vendorPatch/magento/framework/Config/Data.patch (performance fix #1 - vendor/magento/framework/Config/Data.php)
    vendor/maritos/magento2-performance-fixes/vendorPatch/magento/framework/App/ObjectManager/ConfigLoader.patch (performance fix #2 - vendor/magento/framework/App/ObjectManager/ConfigLoader.patch)
    vendorPatch/magento/framework/Interception/Config/Config.patch (performance fix #3 - vendor/magento/framework/Interception/Config/Config.patch)
```

That's it! Happy coding!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.create-magento-app.com/usage-guide/improve-performance.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
