18

I turned off all caches and I set deployment mode to development. So my Magento 2 development sites on all machines are very slow compared to Magento 1.x sites.

Is it normal for Magento 2?

What are the server and Magento configurations that we must be using for Magento 2 development sites so that it has maximum speed?

Update:

On mac for local development, I was able to speed up the site by disabling opcache since there was configuration issue.

  • Install Redis to replace backend file cache. And use memcache for php sessions. Enable cache and disable the cache sections that you don't want enabled when working on a particular task. If you're styling the theme only, use grunt watch and enable all cache. How to configure is in magento 2 official documentation. – obscure May 31 '16 at 21:01
  • redis is useless unless you have 100k+ products – Claudiu Creanga Jun 4 '16 at 20:43
  • I am also suffering from slow development on local window PC. According to your experience, it would be better for me i start local development in Ubuntu or Linux Mint? and what configuration you recommend ? – Jai Dec 6 '16 at 11:15
12

You can use this vagrant box https://github.com/EcomDev/fast-hypernode.

I use it and it is quite fast. In developer mode with cache disabled and xdebug a page refresh is about 2-3 seconds.

Or you can use the vagrant box provided by magestead: http://www.magestead.com/

  • use php7.
  • use gulp for generating css and js (faster than grunt). You can try the already built configuration by snowdog (ready in 2 minutes): https://github.com/SnowdogApps/magento2-frontools
  • use 3gb of ram if doing testing.
  • disable only the cache that you need. If you're doing frontend you don't need to disable any cache.
  • use livereload or browsersync for frontend development so that you don't need to reload pages.

Understand what magento commands do and when to run them. If you're running a lot of setup:static-content:deploy then you'll go mad seeing those dots. Grunt or gulp don't know about @magento_import so that's why when you add or remove files you need to run dev:source-theme:deploy which is much faster than the above one.

What doesn't improve:

Unless you have over 100k products redis makes no difference so don't bother (http://www.developers-paradise.com/wp-content/uploads/2016/05/05-Yaroslav-Rogoza-Magento-2-performance-comparison-in-different-environments.pdf).

Currently because of how magento2 uses requirejs (2mb of js), http2 makes no difference either.

  • I am also suffering from slow development on local window PC. According to your experience, it would be better for me i start local development in Ubuntu or Linux Mint? and what configuration you recommend ? – Jai Dec 6 '16 at 11:15
  • @Jai sorry, don't have experience with Mint. I use mac and ubuntu. – Claudiu Creanga Dec 6 '16 at 11:47
  • Sir...Can i expect good development speed of magento 2...if i use Vagrant on my window 7 ( i5+12Gb Ram) Or should i go to ubuntu with this system configuration because window is frustrating slow in development – Jai Dec 6 '16 at 12:11
  • 1
    @Jai Windows is ok. You should aim for 2-3 seconds refresh in developer mode with some of the caches on. check how fast is this one github.com/alankent/docker-gsd on your computer and aim for that speed. for vagrant I recommend hypernode packagist.org/packages/byteinternet/hypernode-vagrant – Claudiu Creanga Dec 6 '16 at 13:54
  • Thanks for your suggestion. I will implement your recommendation and do you feel magento development can be done fast in ubuntu and Mac as compare to windows? – Jai Dec 7 '16 at 4:02
7

Depending on what type of development you plan on doing you might find switching to client side css compilation improves a development sites speed significantly

Stores > Configuration > Advanced > Developer > Front-end development workflow

Switch to Client side less compilation

0

Also make sure merge of JS / CSS are disabled when in developer mode this really hits performance, testing shows speeds can drop from 20-30 seconds down to 2 - 3 seconds.

May seem obvious to do this in developer mode but if missed can lead to an incredibly slow environment as i had copied a production environment down to develop on and missed this for a while.

Update

This seems to be an issue that was effecting me in 2.1.7 to 2.1.9 and seems to be fixed within Magento 2.2.X

  • this info seems wrong. Speed should not drop with merge – ladle3000 Apr 6 '18 at 1:15
  • @ladle3000 Also you wouldn't really want to merge and minify in development just makes it harder to see what files need to be changed for CSS / JS modifications anyway. – harri Apr 6 '18 at 7:29
  • I see your points. I think perhaps because I migrated directly to 2.2 I never faced this. What version you on? – ladle3000 Apr 6 '18 at 7:57
  • This may be fixed now in 2.2.0 but just seems like an extra step. I tried to test this morning but when i enable in developer mode it seems to still be disabled? Im on 2.2.3 now – harri Apr 6 '18 at 8:00
0

Disable the following caches so you don't need to run the CLI commands to clear cache.

CONFIG
LAYOUT_GENERAL_CACHE_TAG
BLOCK_HTML
FPC
0

The main reason why magento2 is slow in developer mode is related to thousand of static and compiled files generated on the fly.

There are 3 solutions for this:

  • Mount whole directory with NFS (SSD is still mandatory).

  • Mount only app directory (whoever your hardware it will work fine) but you lose access to /vendor directory on your host machine.

  • Mount whole project with rsync and exclude directories where files are generated (pub/static, generated/code etc...).

You can give it a try here: https://github.com/zepgram/magento2-fast-vm/

0

Opcache give an important boost to performance, just don't forgot to enable timestamp validation to avoid refreshing cache when modifying files

opcache.validate_timestamps = On
0

If you are on Windows try this stack it is very fast: https://winnmp.wtriple.com/ using nginx and php-fpm and enable Zend Opcache

And for caches you can leave them all on but use this file watcher which auto flushes only the caches needed: https://github.com/mage2tv/magento-cache-clean

-4

To boost the speed of Magento 2 store, follow these steps:

  • First Make sure that you have fulfilled all the system and server requirements.
  • Update the Magento to its latest version.
  • Enabled the Varnish Cache
  • Enabled the Flat Categories and Products -Optimize Image, Javascript and CSS
  • Set Up CDN
  • Always use bug-free extensions and lightweight theme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.