Question

I install Magento 2.1.2 on a vagrant powered virtualbox with Ubuntu 16.04 64bit with 4GB RAM and 2 processors on a MacBook Pro 2015 with 16GB RAM and 2,9 Ghz Intel Core i5. I have faked a domain https://www.testing.com for that box. Magento is installed in a subdirectory https://www.testing.com/shop

On the machine itself the folder structure in short is:

/var/www/share/testing.com/htdocs (webroot)                  -> symlink to /var/www/share/testing.com/cms/current
/var/www/share/testing.com/cms/current                       -> symlink to /var/www/share/testing.com/cms/deploy/<datetime>/htdocs
/var/www/share/testing.com/cms/deploy/<datetime>/htdocs/shop -> symlink to /var/www/share/testing.com/shop/current
/var/www/share/testing.com/shop/current                      -> symlink to /var/www/share/testing.com/shop/deploy/<datetime>/htdocs

Already the installation is super slow. With the web wizard it fails to install as it gets stuck at installing the user configuration.

As adviced in other tickets I thus install it via composer and commandline. But also on the commandline "generating autoload files" takes >5min.

After the successful installation the whole bare shop is super slow. Pages take >1min to load. No difference in the backend. Deploying static files does not change the behavior.

Changing to production mode is impossible as it generates seemingly infinitely. I let the script run for about 3 hours until I stopped it.

One other thing that is strange is that all scripts run with "php bin/magento ..." take a lot of time to "start". I send the command and then it takes about a minute to actually produce the first output. After it produces the first output the scripts seem to run at a fair speed (except the one for switching to production mode). This happens for everything I do. Like clearing/flushing caches, deploying static files, installing and so on.

Maybe there is a problem with the autoloader? Could that time be the time the autoloader indexes all needed files?

Well anyway the question is: why is my Magento slow? What else could I do find the reason?

edit

This is the install command I use:

php current/bin/magento setup:install --admin-firstname=xxx --admin-lastname=xxx --admin-email=xxx --admin-user=admin --admin-password=admin1234 --base-url=https://www.testing.com/shop/ --backend-frontname=xxx --db-host=localhost --db-name=xxx --db-user=xxx --db-password=xxx --language=de_DE --currency=EUR --timezone=Europe/Berlin --use-rewrites=0 --use-secure=1 --base-url-secure=https://www.testing.com/shop/ --use-secure-admin=1 --admin-use-security-key=1 --session-save=db --cleanup-database

I tried with use-rewrite on and off. No change in behaviour though.

edit2

Here is a har file of the second call of the frontend: https://gist.github.com/anonymous/318d183e1be5d4ea5b674654c8fc5f0e

You can view it in http://www.softwareishard.com/har/viewer/

Also I attached a htop screenshot while loading the admin backend. enter image description here

And one other thing I found strange is the admin url: https://www.testing.com/shop/index.php/zoo/admin/index/index/key/<key/

Why is are there 2 index in there?

Was it helpful?

Solution

VirtualBox shared folder is slow, and Magento use file caches by default, it has many classes and resources in file system, it's why it may be slow.

Try add type: "nfs" to config.vm.synced_folde .., like config.vm.synced_folder "./", "/vagrant", type: "nfs", and reload vm (vagrant halt && vagrant up)

OTHER TIPS

First of all make sure magento mode should be production, then host the magento from the pub folder not from the root folder. It will make your magento super fast.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top