Skip to content

Very BAD Performance with Magento 2 on Mac OS X #2924

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jleplomet opened this issue Jan 7, 2016 · 39 comments
Closed

Very BAD Performance with Magento 2 on Mac OS X #2924

jleplomet opened this issue Jan 7, 2016 · 39 comments

Comments

@jleplomet
Copy link

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?

@alankent
Copy link

alankent commented Jan 8, 2016

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.

@markshust
Copy link
Contributor

@jleplomet are any files hosted on an external/third-party/remote volume disk? i've noticed this can dramatically slow down m2.

@Vinai
Copy link
Contributor

Vinai commented Jan 8, 2016

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.

@bartdelvaux
Copy link
Contributor

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.

@jleplomet
Copy link
Author

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.

@rudik99
Copy link

rudik99 commented Jan 12, 2016

I also had the same issue, the solution was the same as @bartdelvaux - disable the merging of JS and CSS.

@markshust
Copy link
Contributor

@rkhoury82 this is odd, because from my experience, merging JS doesn't have any change on output? #2925

@jleplomet
Copy link
Author

Any update to this? I cant edit layout xml files without disabling cache and therefore back at 30sec-1min page load.

@alankent
Copy link

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.

@markshust
Copy link
Contributor

@alankent i think i have replicated this consistently with my docker images when js merging (& bundling) is turned on. i'll confirm shortly.

@alankent
Copy link

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?

@markshust
Copy link
Contributor

Yes, to be able to test in same environment as staging + production. I don't think this ticket is mac-related.

@jleplomet
Copy link
Author

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.

@markshust
Copy link
Contributor

@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,

@jleplomet
Copy link
Author

@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?

@jk2081
Copy link

jk2081 commented Feb 29, 2016

@jleplomet I would be curious to know what setup/settings you are using and if you've found an answer to your question.

@gazjoy
Copy link

gazjoy commented Mar 4, 2016

+1 I also have this problem on my Mac.

@crantron
Copy link

same

@JDavidVR
Copy link
Contributor

JDavidVR commented Apr 8, 2016

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

@jhon-wagento
Copy link

+1 any tips are welcomed.. same configurations.. just on a LAMP environment

@alankent
Copy link

alankent commented Apr 8, 2016

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").

@MikaRinneAmbientia
Copy link

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

@markshust
Copy link
Contributor

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

@hshar7
Copy link
Contributor

hshar7 commented May 2, 2016

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.

@hshar7 hshar7 closed this as completed May 2, 2016
@MikaRinneAmbientia
Copy link

Yes, I can try vagrant next. But happy to say it works on OSX.

@MikaRinneAmbientia
Copy link

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.

@rehoehle
Copy link

With MAMP it takes 30 seconds for every page load and thats very annoying. Is there a solution to fix the performance?

@markshust
Copy link
Contributor

make sure you have opcache installed. noticed a huge performance increase with m2 with my docker images + opcache.

@jefflenz
Copy link

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.

@reillo
Copy link

reillo commented Jun 5, 2018

I am also developing in mac and it was very slow. Disabling JS/Css merging makes it faster.

@nidheesh-eglobeits
Copy link

Check whether OPCache is enabled. I had the same issue when using docker and enabling OpCache solved this.

@zepgram
Copy link

zepgram commented Sep 10, 2018

I made this vagrant which allow you to customize mount options and has great performance:

  • nfs mount or regular mount
  • directory mount /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.

magento-team pushed a commit that referenced this issue Sep 18, 2018
Fixed issues:
- MAGETWO-92175: [Backport for 2.2.x] Wrong product grid behavior in admin panel
- MAGETWO-72051: [Backport for 2.2.x] Wrong file upload behavior
- MAGETWO-88658: [Backport for 2.2.x] Incorrect category attributes displaying
- MAGETWO-93272: [Backport for 2.2.x] Product Video feature not GDPR compliant
@SteveChurch
Copy link

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.

@vtransy
Copy link

vtransy commented Sep 13, 2019

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 :(

@r-martins
Copy link
Contributor

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:

  1. Enable all caches and use Mage2Tv cache cleaner tool while developing.
  2. Try to use it with nginx and http/2 (as magento does 500 requests per page and the browser limits it when using http/1.
  3. Enable opcache (don't do this if you're developing)
  4. Play a little with your my.cnf and Innodb params
  5. Use redis

If you make it run faster or the same as M1 when developing, please let me know what you did. :)

@vtransy
Copy link

vtransy commented Sep 13, 2019

@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 :(((((((

@r-martins
Copy link
Contributor

r-martins commented Sep 13, 2019

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).

@Vinai
Copy link
Contributor

Vinai commented Sep 13, 2019

@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+.

@r-martins
Copy link
Contributor

r-martins commented Sep 15, 2019

@Vinai Never heard about Valet+. Sounds to be an incredible alternative to Mamp and has http/2 support. Thanks for the hint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests