Magento 2 running so slow on localhost development
I recently started developing on magento2 new extensions or customizations, and my first impression was a nightmare. I have to wait about 20-30s for every change I make? really?
I'm talking about development mode, I know that in production with cache enabled and other things the website can be smooth. But when I'm working with an extension or layout problem I need to be removing static files, clearing cache, etc.
My question is, how you all M2 developers work? because I don't believe you have to wait 20s-30s for refreshing the page...
My environment: My pc is "good" i5 with 8gb RAM. I need to work with Windows so I use vagrant:
- Use of all 4 cores CPU
- Use 5120MB of RAM
- Ubuntu/trusty64 - Ubuntu 14.04
- PHP Version 7.0.12-1+deb.sury.org~trusty+1
- MariaDB - 10.1.18-MariaDB-1~trusty
- Magento 2.1.2 is installed only with sampledata (no more modules are installed)
- (Ask me if you wanna know sth more)
What is happenning exactly? Usually M2 responds okay, slow but okay, about 5-10s to load the pages, but sometimes (more usually than sometimes) it just stucks forever! sometimes is the first page and sometimes are the css,js,html files but always the problem is with TTFB.
I saw a problem going to setup wizard too... with angular.js these files lasts forever...
These 2 pictures are about navigating inside setup wizard.
Then another one navigating on frontend catalog:
What am I asking exactly? Is this normal? you guys work with this timing? I commented this with some colleagues and we just don't believe, I have to be working like this? I sometimes despair of waiting all the time watching the screen...
If someone asks me for show him a test, like creating a new product or something like that he just freaks out... Creating a new order, filling the fields and every field executes a js that lasts for 5-6s...
I don't know but I feel so bad developing with this stuff...
Haven't had the chance to play with magento 2: but id assume that most of the performance issues comes from your vagrant environment. Do you use virtualbox with vagrant or something else. Using multiple cores with virtualbox degrades performance. Do you run the magento from a shared folder on the vagrant > magento writes files back to the same share you get performance issues.
Also you also might be running out of memory on your system what leads to using swap on the host if you give the vagrant 5gigs. only increase the amount if you actually need it.
A big part of your problem is that you are on Windows. I was on Windows for years and it was super slow with vagrant/magento. This is because of the file synching mode, its not up to par with nfs. I started dual booting into Ubuntu desktop and my magento sites were very fast, then a while later I got a mac, which uses NFS, and it is also very fast.
Yes, it's vagrant with virtualbox. Why using more cores have to degrade performance? I assume giving all resources to VM may be slow "my pc" but faster my VM... And the folder I'm using is /var/www (I tried to not use shared folder, it's only "linux" what is running now). How can I see what is failing? I can execute top, or commands like that.... but don't know how to interpret...
@ShawnAbramson Yep... we suggested to install dual boot just to try it because as I said we don't believe M2 developers are working like I'm currently doing hehe...
@slayerbleast on the multi core bit https://github.com/geerlingguy/drupal-vm/issues/855 performance issue. See the link rdsubhas/vagrant-faster#5 there. Not sure how it affects on window thought. Id suggest trying on limiting your memory also to 2 gigs and trying then. If only have only 8 gigs of ram, you allocate vagrant 5 gigs so that leaves 3 gigs for your browsers and operating system.. I'd assume you are most likely swapping that could cause performance issues.
Just as a disclamer: I work mainly on my mac with 16gigs of memory and I7 processor so sadly I'm not prevvy to all windows tweaks that you could do, but with magento development high clock speed is better than your core count to some extent. Running on multiple cores helps on concurrency but its quite mute on your case as you are only one connecting there.
@ShawnAbramson I was also adviced to try on Linux. Unfortunately neither turning off directory sync. on Windows, nor running VM on Linux helped. It was slow to the point of non-working state. VM had 2 cores from i5 + 4GB RAM. The only local environment where M2 works for me is Bitnami VM. If you have vagrant VM with provisioning script that works for you I'd really appreciate if you could share it.
I tried everything and the only thing it works is the virtual machine that provides bitnami. https://bitnami.com/stack/magento/virtual-machine
Seriously, I don't know what has this vm, but goes really fast. I tried creating my VM using a fresh installation of Ubuntu, CentOS, etc. But no works so fine like this VM.