Magento 2

Improve the performance for development in the Magento 2

November 24, 2021

Improve the performance for development in the Magento 2

In this article we’ll look at strategies, settings and code changes to improve the performance for development in the Magento 2 framework.

improve the performance for development in the Magento 2 cover

What’s up programmer, okay? Let’s learn how to improve the performance of the dev environment in Magento 2

Right after Magento is installed, loads of more than 10 seconds are noticeable, and in the administrative area sometimes reaching 1 minute

This is a big problem to developing solutions in Magento and a problem for your productivity, so let’s make some adjustments that will help alleviate this

Increase the memory that can be used

Some Magento 2 configuration files like .htaccess and .ini’s limit RAM usage to 756M

For best results change to at least 2G depending on free memory on your PC

I use this value as 4G

Tip: use VS Code replace to change all files at once, and don’t change .php files

Here is a way to do the search (in this example, I had already changed all occurrences)

Merge from CSS and JS files

Another measure that helps a lot is to make the famous merge of these files, and consequently reduce the number of requests

For this, you must access the administrative area

And enter the menu: Stores | Configuration | Advanced | developer

On this screen, enable CSS and JS merge and minify, an example follows:

Disable Xdebug

Another measure that helps a lot in improving performance

We can disable it via the terminal, with the commands:

sudo phpdismod xdebug

sudo service apache2 restart

The last one is to restart the apache server and persist the changes

|  Do you want to specialize in Web Development? Check out our course catalogue.

Enable  the Developer Mode

This step does not change the performance much, but it does display errors for us and does not generate cache files

So it is extremely necessary (and recommended), that when developing this mode, it is enabled

You just need to type this command in the terminal:

bin/magento deploy:mode:set developer

So Magento 2 changes its mode to dev, and you can debug it more easily

Enable caches

A bad idea when developing the front-end, but for the back-end nothing will affect it, and you gain performance

Also you can clear the cache via terminal, if you are making templates and then solve this problem


In this article we have seen measures that will improve performance for Magento 2 development

Another interesting tip is to join an SSD, which can greatly improve file loading times and consequently improve performance

Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x