Hello
Im trying to figure out how to develop a custom theme with Magento 2 and its been a huge pain so far. I have developer mode set with
bin/magento deploy:mode:set developer
The problem is that Magento takes over a minute to load any page, its almost unusable. My system specs are
Mac OS X 10.11.2
Apache 2.4.16
PHP 5.6.16 - memory_limit: 2048M
MySQL 5.6
I installed PHP/MySQL locally to avoid the virtual setup but it seems the slow performance is about the same. Is there any tips to increase page load time when set to developer mode?
That is very strange. Could you send me a direct email at akent at magento dot com? We are getting some reports of wildly different performance - trying to track down the common factor. E.g. my first load of home page is under 10 seconds, second load is under 1. That does not line up with over a minute for every page.
@jleplomet are any files hosted on an external/third-party/remote volume disk? i've noticed this can dramatically slow down m2.
Have you disabled caching? What is the output of $ bin/magento cache:status
?
Being used to working with (some) disabled caches on Magento 1, it was a change I had to learn to live with when developing with Magento 2. Caching should practically never be disabled.
Also, is xdebug installed in your php? You can see by running php -m | grep xdebug
. If that outputs xdebug
it is installed.
If so, make sure it is not enabled for every request automatically, but instead only on request.
In the PHP settings, the value for xdebug.remote_autostart
has to be set to Off
and xdebug.remote_mode
should be req
.
Some time ago, I was having the same issue. I could solve this by disabling the merging of Javascript and CSS.
In some cases, the generation of these files slows down the site.
I have all caches disabled for development of my theme. I have pinpointed the issue to be server side compilation of static assets. Its taking 30s-1min to finish and display the page. This happens both on frontend and admin side.
I am not using any external/third-party/remote volume disk. I have Apache, PHP/MySQL running directly on my iMac/Macbook SSD
xdebug is also installed but disabled on xdebug.remote_autostart
My solution is to enable all cache and have grunt compile less files. This seems to speed things up.
I also had the same issue, the solution was the same as @bartdelvaux - disable the merging of JS and CSS.
@rkhoury82 this is odd, because from my experience, merging JS doesn't have any change on output? https://github.com/magento/magento2/issues/2925
Any update to this? I cant edit layout xml files without disabling cache and therefore back at 30sec-1min page load.
Hi @jleplomet - which of the approaches other people have suggested have you tried? And did you send me an email as I requested? Sorry if I missed it.
Grunt is certainly the fastest approach. But it is not clear from your report how slow it is still going, and what you are doing that makes it slower than for other people. (I am not saying it is not slower, only there is not much information to work on.) Not everyone is having the same slow down as you, so 1 minute page loads is not a generic problem. So we have to work out what is different in your circumstance.
I was working with someone else - their machine was going a lot slower than expected. Never worked out why, but different people running exactly the same code were having different performance. Very hard to diagnose, but almost felt like maybe different anti-virus software or other background jobs could be kicking in (or machine thrashing etc). I was going to try the same experiments with you to try and see if we could identify the cause of the radically different results. The other person I worked with ended up with inconclusive results.
One area that has been reported to have a big impact is the number of locales. Are you developing a theme with multiple locales? If so, could you try again with a single locale and compare the speed difference.
If you have time, please send me a direct email as above - I have a Docker image I would like you to try which would guarantee identical software versions etc. I am hoping this can help identify the problem.
@alankent i think i have replicated this consistently with my docker images when js merging (& bundling) is turned on. i'll confirm shortly.
Thanks @markoshust. I guess the next question is during development, is there any need to have JS merging turned on? I would have said no, that is a production setting. Seem reasonable?
Yes, to be able to test in same environment as staging + production. I don't think this ticket is mac-related.
Just want to note that I do have merging turned off. My issue is mostly related to the server generating less files, and processing theme files when caching is turned of during theme development. I'm trying to edit layout files, less files, and template files.
@jleplomet your initial ticket was in regards to page load time, not dev building
| The problem is that Magento takes over a minute to load any page,
@markoshust Yes that is correct.
I have noticed that due to server generation of files, this slows down Magento to load on any page.
What is the ideal setup/settings to run Magento 2 while developing custom themes on a local install of Apache/PHP/MySQL?
@jleplomet I would be curious to know what setup/settings you are using and if you've found an answer to your question.
+1 I also have this problem on my Mac.
same
I'm havign performace problem too, when I enable profiler, loading magento takes like 35 secs, matching the routes another 15 sec, laoding layout 20 secs.
Is there any aditional configuration?
I'm using php 5.6.11, mysql 5.6.25, apache 2.4.17
+1 any tips are welcomed.. same configurations.. just on a LAMP environment
For Less files, I strongly recommend looking at Gulp - e.g. https://github.com/SnowdogApps/magento2-frontools. Much faster. I have a few different development approaches listed at http://alankent.me/gsd which have different pros and cons. We are looking to reduce this to "one approach to rule them all" (also known as a "default recommendation").
Experiencing the same. Comparing to Magento 1 on the same machine very slow (Magento 1 running on nginx, Magento 2 on apache not at the same time, though). Haven't touched any configs yet basically, development mode is enabled I think as: SetEnv MAGE_MODE developer
I think this ticket should be closed. Mac OS X isn't listed as supported platforms of M2:
http://devdocs.magento.com/guides/v2.0/install-gde/system-requirements.html
Exactly @markoshust that's why you should give this a try: https://github.com/paliarush/magento2-vagrant-for-developers
This will allow you to develop on an OS supported by Magento without leaving the comfort of your own OS. However, I also use a LAMP stack on my mac using Macports which seems to be fast and reliable but this vagrant setup works on most systems.
Yes, I can try vagrant next. But happy to say it works on OSX.
I know this is closed, my apologizies for posting, but I did a "clean" composer install without sample data on OSX, it feels faster now. Also added local server name ::1 to etc/hosts not sure if has an affect but it was advised around.
With MAMP it takes 30 seconds for every page load and thats very annoying. Is there a solution to fix the performance?
make sure you have opcache installed. noticed a huge performance increase with m2 with my docker images + opcache.
Make sure you have config cache enabled (at the very least) because every asset (image/js/css) is parsed by magento, so each and every request for an asset has to load up magento individually.
I am also developing in mac and it was very slow. Disabling JS/Css merging makes it faster.
Check whether OPCache is enabled. I had the same issue when using docker and enabling OpCache solved this.
I made this vagrant which allow you to customize mount options and has great performance:
/var/www/magento/app
or whole project /var/www/magento
https://github.com/zepgram/magento2-fast-vm
You can work on a fast magento installation and adapt parameters depending on your work practice and your host machine perf.
For example, if your host machine doesn't support NFS option and has bad performance you can mount only app directory which is enough for development.
I have to strongly disagree a lot with the fact it seems people just say "Use Vagrant" - I don't see that as a solution to yet another Magento performance problem running in deployment lifecycles. It has been by far the most underperforming application I have ever had the joy of working with.
I appreciate that there may be some issues with Docker and OSX's file system, however Magento is the first project I have worked on where this actually seems to be noticeable to the naked eye.
Has there been much push for information on exactly what is causing such issues with Docker? - Not every team / org have the option to just chop and change from Docker to Vagrant. Over the years I have fallen out of love with Magento. It has become the Go-To E-Commerce platform, yet lacks any clear focus on performance. I for one no longer back the use of Magento for new clients, it has become quite honestly gross to work with. There are some really nice Python E-Commerce packages coming out which offer a much easier platform to work with, a performance based package which runs on 1/1000th of the cost Magento costs to run. This proves how much Mango needs to just be ditched and re-written, hopefully Adobe will do what they did to Fireworks and ditch it :D
I have never in my life worked on anything which takes more than 10 seconds to load a page in development let alone the 1+ minutes to render a page which we see. The whole platform is stuck in the past.
Magento 2 just seems like a massive Sugar Coating Sh*t task. My 50 pence.
I spent 2k+ USD for a MacPro 2018 with core i9 2.9 + 16Gb ram + 512 SSD
After install magento 2 with PHP 7.1 + Apache 2.4 + MariaDB
Default Magento + sample data
Every page it sends 15-20 seconds to load.
x-debug not installed, opcache not installed.
CSS & JS not bundle, not merge
With Magento 1 it runs like fly but Magento 2 takes to much time to load a page.
How can I improve performance for my Mac or this MacPro has issue?
Everything else goes well with great speed, just Magento 2 NOT :(
Same here @vtransy . I'm with 32Gb, 6 cores, giving 6Gb to Magento 2.
There are some tricks you can do there, but the official recommendation is to use Docker, Kubernetes (or some future similar technology).
They also removed MacOs and Windows from the list of compatible OS.
To run it with Mamp for example, I would recommend to:
If you make it run faster or the same as M1 when developing, please let me know what you did. :)
@r-martins Unfortunately I tried both docker & vagrant on my mac. Both are the same result. I thought that caused by virtual machine not have enough Mem & CPU. I set for VM 9Gb and 8core but it not improve performance for M2.
For now I get stuck with M2 performance. One solution I think about is sell My Mac and buy Dell laptop then install Ubuntu.
But I love MacPro design than other thing :(((((((
Try to enable opcache on Mamp but add/uncomment opcache.validate_timestamps=1
on your php.ini.
This seems to be a good improvement.
Moving from mac to linux is out of discussion (at least for me).
@vtransy From your original post my guess would be that you have the caches turned off. Try running php bin/magento cache:status
to see if that's the case. If so, turn them all on. With a warmed up config cache Magento should be a lot faster.
Also follow the tips @r-martins wrote.
If it isn't the cache, I guess you are using some kind of docker or vagrant setup.
The main issue with any kind of virtualization (docker or vagrant) is not RAM or CPU, but rather the file system synchronization with the host system.
If you choose to go that route I suggest you familiarize yourself with ways to work around the synchronization issues (there are several approaches, with varying complexity, but none come without downsides), or instead run Magento locally with MAMP or valet+.
@Vinai Never heard about Valet+. Sounds to be an incredible alternative to Mamp and has http/2 support. Thanks for the hint.
Most helpful comment
I think this ticket should be closed. Mac OS X isn't listed as supported platforms of M2:
http://devdocs.magento.com/guides/v2.0/install-gde/system-requirements.html