Magento 2非常慢(开发者模式)

时间:2023-01-15 23:06:05

Recently I started developing magento 2 projects.

最近我开始开发magento 2项目。

First I tried on Windows with xampp and it was a mess... every refresh page was a nightmare, about 30-40sec to load the page. I read about it, that Windows system files is so slow working with magento because the large structure it has, and the article almmost was forcing you to use linux for developing on magento projects.

首先我尝试使用xampp进行Windows操作,这是一个烂摊子......每个刷新页面都是一场噩梦,加载页面大约需要30-40秒。我读到它,Windows系统文件使用magento是如此之慢,因为它具有大型结构,而文章almmost迫使您使用linux在magento项目上进行开发。

The problem is I need Windows for another company apps that only works on Windows, I tried to install a virtual machine with Virtualbox, it improved a bit... but the fact I'm working on a virtual machine pissed me off...

问题是我需要Windows用于另一个仅适用于Windows的公司应用程序,我尝试使用Virtualbox安装虚拟机,它改进了一点......但我正在虚拟机上工作的事实让我生气...

The next solution and I'm working currently, is using vagrant. Okay, I feel good developing on this way but it keeps going slow... 15-20s...

我现在正在使用的下一个解决方案是使用vagrant。好吧,我觉得这种方式很好,但它一直很慢...... 15-20s ......

My config on Vagrant is 5120MB (pc has 8GB) and use all my pc 4 cores.

我在Vagrant上的配置是5120MB(pc有8GB)并使用我所有的4个内核。

I'm feeling so bad working like this... when I was working on my previous projects, with symfony/Laravel/Codeigniter, was like:

我感觉很糟糕这样......当我在以前的项目中工作时,使用symfony / Laravel / Codeigniter,就像:

write some lines of code, tab to browser, F5, INSTANTLY see changes.

写一些代码行,选项卡到浏览器,F5,立即查看更改。

On M2: write some lines of code, tab to browser, F5, wait... wait... okay now it refreshes the page, but it's not loaded, wait... wait... hmmm almost... okay. No changes but I cleaned the cache... ohhh I guess I had to remove static files too. Go for it... wait again...

在M2上:写一些代码行,选项卡到浏览器,F5,等待......等等......好吧现在它刷新页面,但它没有加载,等待......等等......嗯几乎......好吧。没有变化,但我清理了缓存......哦,我想我也必须删除静态文件。去吧......再等一下......

God... There's no way M2 goes faster? I'm only asking 5s or something like that... it's just I'm feeling so dumb looking the screen waiting all the time...

上帝...... M2没有办法加速吗?我只问5s或类似的东西...只是我感觉如此愚蠢,看着屏幕一直在等待......

For aclarations, I'm only asking for development mode, I tried had to install another project of magento on production mode for testing things faster and then it's okay fluid as hell compared with developer mode... because... omg... just try to do an order workflow again and again...

对于声音,我只是要求开发模式,我试图在生产模式下安装另一个magento项目以便更快地测试事物然后它与开发者模式相比可以流畅......因为... omg ...只是尝试一次又一次地执行订单工作流程......

Well that's all... The only thing I didn't try is using Linux environment on the computer... but it's just the same as using vagrant... I don't understand... how are you developing M2 developers? in special frontend developers... I don't believe they are working the same way as me... waiting 20sec for loading the pages + cleaning cache + removing static files, etc.

好吧,这就是...我唯一没有尝试的是在计算机上使用Linux环境...但它与使用流浪者一样......我不明白......你是如何开发M2​​开发人员的?在特殊的前端开发人员...我不相信他们的工作方式和我一样......等待20秒加载页面+清理缓存+删除静态文件等。

Details: I tried everything with vagrant but don't improve, I'm currently on Ubuntu 15.04, Apache 2.4, PHP 5.6 (I tried 7 but still the same) mysql 5.6

详细信息:我尝试了一切与流浪但没有改进,我目前在Ubuntu 15.04,Apache 2.4,PHP 5.6(我试过7但仍然相同)mysql 5.6

This is the network tab: http://i.imgur.com/HG7mbeX.png Magento 2非常慢(开发者模式)

这是网络标签:http://i.imgur.com/HG7mbeX.png

9 个解决方案

#1


2  

I tried everything and the only thing it works is the virtual machine that provides bitnami. https://bitnami.com/stack/magento/virtual-machine

我尝试了一切,它唯一有效的是提供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 doesn't work so fine like this VM.

说真的,我不知道这个vm是什么,但速度非常快。我尝试使用全新安装的Ubuntu,CentOS等来创建我的虚拟机。但是这样的虚拟机并没有那么好用。

#2


1  

my recipe:

  • Use *nix as your main OS

    使用* nix作为主操作系统

  • Use docker with PHP 7 and Nginx

    使用docker与PHP 7和Nginx

  • use gulp for generating css and js (faster than grunt)

    使用gulp生成css和js(比grunt更快)

  • use redis and varnish

    使用redis和清漆

  • disable only needed caches

    仅禁用所需的缓存

And the most valuable advice - you really need SSD to work with magento2 if you still trying to develop on HDD

最有价值的建议 - 如果您仍在尝试在HDD上进行开发,那么您真的需要SSD与magento2一起使用

p/s Magento 2 more complicated than Symfony/Laravel/CI (M2 consist Symfony by the way) and can't be so fast as pure frameworks

p / s Magento 2比Symfony / Laravel / CI更复杂(顺便说一句,M2包括Symfony)并且不能像纯框架那么快

#3


1  

2018 Update, Magento 2.2.4

2018年更新,Magento 2.2.4

Vagrant + Windows + Magento2 = disaster. Vagrant + Apple + Magento2 = disaster.

Vagrant + Windows + Magento2 =灾难。 Vagrant + Apple + Magento2 =灾难。

Ubuntu + Magento2 = cooking on gas.

Ubuntu + Magento2 =用煤气烹饪。

Simple modules, e.g. a widget, take many days more than the expected 2-3 hours and it is not possible to remember what you are doing if it takes a minute to open a page, particularly so if you have to clear caches, compile, upgrade or anything else that should take no-time-at-all.

简单的模块,例如一个小部件,比预期的2-3个小时花费很多天,如果打开一个页面花了一分钟就不可能记住你在做什么,特别是如果你必须清除缓存,编译,升级或其他任何东西这应该是没有时间的。

This I have experienced first hand, from working in an office where the options are Mac or Windows. After spending a whole day trying to change the template directive and failing to make one configuration change in 8 hours, I thought about giving it a go on a linux box to see if I had gone mad or if this Vagrant contrivance is as helpful as that drunken bum sleeping rough in the park down the road.

这是我第一手经验,在办公室工作,选择Mac或Windows。在花了一整天试图更改模板指令并且未能在8小时内进行一次配置更改之后,我想在Linux机箱上试一试,看看我是否疯了,或者这个Vagrant的设计是否有所帮助醉酒的屁股睡在路边的公园粗糙。

The aged linux box with anaemic RAM, an old SSD, stock Apache and no fancy cache things completed the task without problem, I was able to switch between developer and production modes effortlessly and get what had taken me days to not do done in minutes.

带有贫血RAM的老式linux机箱,旧的SSD,库存Apache以及没有花哨的缓存功能完成了任务而没有问题,我能够毫不费力地在开发人员和生产模式之间切换,并在几分钟内完成了我几天没做的事情。

The work machine was 8th generation i7, the Vagrant setup was very much someone's baby and a lot of time had been spent building the beast. Yet tectonic plates move faster. Vagrant and virtualisation might be fashionable but it is no use for M2 development. In fact I installed M2 and did all the db and vhost setup for it in less time than it takes for a Vagrant box to build.

工作机器是第8代i7,Vagrant设置是非常有人的宝贝,并且花了很多时间来建造野兽。然而构造板块移动得更快。流浪和虚拟化可能很时尚,但它对M2的开发毫无用处。实际上我安装了M2,并且在比Vagrant盒子构建所花费的时间更短的时间内完成了所有db和vhost设置。

As for performance, since M2 on a basic linux setup is 10x faster than some clumsy Vagrant effort, it is easy to see where the real speed problems of Magento 2 are. If you fire up Lighthouse in Chrome you will see TTFB is absolutely fine but the performance halves if you minify and merge the JS + CSS. This is because M2 has a megabyte of scripts to download. This is the performance killer. If you are working on a Vagrant box then you will never see this and not have the speed to fix it. By fix it I mean write a proper theme that doesn't have nonsense such as jQuery loading on every page.

至于性能,由于基本的Linux设置上的M2比一些笨拙的Vagrant工作速度快10倍,因此很容易看出Magento 2的实际速度问题在哪里。如果你在Chrome中启动Lighthouse,你会看到TTFB绝对没问题,但是如果你缩小并合并JS + CSS,性能会减半。这是因为M2有一个兆字节的脚本要下载。这是性能杀手。如果您正在使用Vagrant盒子,那么您将永远不会看到这个并且没有速度来修复它。通过修复它我的意思是写一个没有废话的正确主题,例如在每个页面上加载jQuery。

For production you need something that scales so you can get the normal speed enhancements going for that, e.g. Redis, opcode caching, Varnish, tweaked php-fpm, tweaked MySQL/MariaDB. If you are developing on Linux then you can test these things on localhost knowing they will work fine on production. With that abomination that is Vagrant you will be dabbling with these optimisations prematurely because you are hoping and praying for a performant machine because you need to get work done. However, in so doing, and with the absence of native speed, you will not get anything done.

对于生产而言,您需要一些可扩展的东西,以便您可以获得正常的速度增强,例如: Redis,操作码缓存,Varnish,调整php-fpm,调整MySQL / MariaDB。如果您正在Linux上进行开发,那么您可以在localhost上测试这些东西,因为他们知道它们可以在生产中正常工作由于令人憎恶的是Vagrant,你会过早地涉足这些优化,因为你希望并为一台高性能机器祈祷,因为你需要完成工作。但是,这样做,并且由于缺乏本机速度,您将无法完成任何工作。

If you don't have a spare machine to put linux on then just go to the local tip, get any PC, shove an SSD in it and you are good to go.

如果您没有备用机器来安装Linux,那么只需转到本地提示,获取任何PC,将SSD推入其中并且您很高兴。

#4


1  

In "developer" mode, all caches were disabled.That why magento become slow. I suggest to enable caches by execute command

在“开发人员”模式下,所有缓存都被禁用。这就是为什么magento变慢了。我建议通过execute命令启用缓存

./bin/magento cache:enable

However, you need to clean cache ./bin/magento cache:clean every time you modify xml files or configurations.

但是,每次修改xml文件或配置时都需要清除缓存./bin/magento缓存:clean。

#5


0  

For production environment:

对于生产环境:

You must use Redis for handle Cache, Full Page Cache et Session (http://devdocs.magento.com/guides/v2.0/config-guide/redis/config-redis.html)

您必须使用Redis来处理缓存,整页缓存和会话(http://devdocs.magento.com/guides/v2.0/config-guide/redis/config-redis.html)

You must use Varnish for HTTP cache built in with Magento (http://devdocs.magento.com/guides/v2.1/config-guide/varnish/config-varnish.html)

您必须使用Varnish内置Magento的HTTP缓存(http://devdocs.magento.com/guides/v2.1/config-guide/varnish/config-varnish.html)

You need to set up production Magento mode. (http://devdocs.magento.com/guides/v2.1/config-guide/bootstrap/magento-modes.html)

您需要设置生产Magento模式。 (http://devdocs.magento.com/guides/v2.1/config-guide/bootstrap/magento-modes.html)

You must use ElasticSearch for search engine, EE only (http://devdocs.magento.com/guides/v2.1/config-guide/elasticsearch/es-overview.html)

您必须将ElasticSearch用于搜索引擎,仅限EE(http://devdocs.magento.com/guides/v2.1/config-guide/elasticsearch/es-overview.html)

You must use PHP 7

您必须使用PHP 7

You may use MariaDB even if it is not supported by Magento 2.

即使Magento 2不支持,您也可以使用MariaDB。

You must use CSS minification and JS minification and JS bundling (which works only on production mode).

您必须使用CSS缩小和JS缩小和JS捆绑(仅适用于生产模式)。

Check the official Magento 2 documentation in order to set up this production configuration.

查看官方Magento 2文档以设置此生产配置。

#6


0  

Try to disable synchronisation with default vagrant sync folder (just comment config.vm.synced_folder in VagrantFile and reload) - it's to slow when need to work with a lot of files...

尝试禁用与默认vagrant同步文件夹的同步(只需在VagrantFile中注释config.vm.synced_folder并重新加载) - 当需要处理大量文件时,它会变慢...

Also in developer mode will be useful to generate static files: bin/magento setup:static-content:deploy and ensure that all caches are enabled: bin/magento cache:status

同样在开发人员模式下,生成静态文件也很有用:bin / magento setup:static-content:deploy并确保启用所有缓存:bin / magento cache:status

If it don't help you can try Magento DevBox tool based on Docker: http://devdocs.magento.com/guides/v2.1/install-gde/docker/docker-over.html

如果它没有帮助你可以尝试基于Docker的Magento DevBox工具:http://devdocs.magento.com/guides/v2.1/install-gde/docker/docker-over.html

#7


0  

A bit late here but i think the answer while working on vagrant / docker is mostly that the I/O of files is terribly slow.

这里有点晚了,但我认为在处理vagrant / docker时的答案主要是文件的I / O非常慢。

My solution was simply do disable the whole shared folder and replace it with a remote project (sftp connection) in PhpStorm. All files are so stored within the virtual machine and don't have to be synced everytime the page needs a reload.

我的解决方案是简单地禁用整个共享文件夹并将其替换为PhpStorm中的远程项目(sftp连接)。所有文件都存储在虚拟机中,每次页面需要重新加载时都不必同步。

The main benefit of course is, that it is amazingly fast while working on developer mode.

当然,主要的好处是,在开发人员模式下工作时速度惊人。

But also there are some minor problems while working with this setup:

但使用此设置时也存在一些小问题:

  • You can't run commands straight from your terminal. You have to ssh into your vagrant for running magento2 cli commands.

    您无法直接从终端运行命令。你必须ssh到你的流浪汉运行magento2 cli命令。

  • After running composer updates you may have to download the whole folder again, because in PhpStorm remote changes are not downloaded automatically.

    运行作曲家更新后,您可能必须再次下载整个文件夹,因为在PhpStorm中不会自动下载远程更改。

#8


0  

If you work in developer mode you need to disable JS/CSS merge, disable xdebug and enable opcache. Feel free to run thes MySQL queries on your dev DB and flush cache. This will increate the site performance in developer mode.

如果您在开发人员模式下工作,则需要禁用JS / CSS合并,禁用xdebug并启用opcache。随意在您的dev DB上运行MySQL查询并刷新缓存。这将在开发人员模式下提高网站性能。

UPDATE core_config_data SET value = '0' WHERE path = 'dev/css/merge_css_files';
UPDATE core_config_data SET value = '0' WHERE path = 'dev/css/minify_files';
UPDATE core_config_data SET value = '0' WHERE path = 'dev/js/merge_files';
UPDATE core_config_data SET value = '0' WHERE path = 'dev/js/minify_files';
UPDATE core_config_data SET value = '0' WHERE path = 'dev/js/enable_js_bundling';
UPDATE core_config_data SET value = '0' WHERE path = 'dev/static/sign';

#9


0  

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

我做了这个流浪者,允许你自定义挂载选项,并具有很好的性能:

  • nfs mount or regular mount
  • nfs挂载或常规挂载

  • directory mount /var/www/magento/app or whole project /var/www/magento
  • 目录mount / var / www / magento / app或整个项目/ 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.

您可以进行快速的magento安装并根据您的工作实践和主机性能来调整参数。

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.

例如,如果主机不支持NFS选项并且性能不佳,则只能安装足以进行开发的app目录。

#1


2  

I tried everything and the only thing it works is the virtual machine that provides bitnami. https://bitnami.com/stack/magento/virtual-machine

我尝试了一切,它唯一有效的是提供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 doesn't work so fine like this VM.

说真的,我不知道这个vm是什么,但速度非常快。我尝试使用全新安装的Ubuntu,CentOS等来创建我的虚拟机。但是这样的虚拟机并没有那么好用。

#2


1  

my recipe:

  • Use *nix as your main OS

    使用* nix作为主操作系统

  • Use docker with PHP 7 and Nginx

    使用docker与PHP 7和Nginx

  • use gulp for generating css and js (faster than grunt)

    使用gulp生成css和js(比grunt更快)

  • use redis and varnish

    使用redis和清漆

  • disable only needed caches

    仅禁用所需的缓存

And the most valuable advice - you really need SSD to work with magento2 if you still trying to develop on HDD

最有价值的建议 - 如果您仍在尝试在HDD上进行开发,那么您真的需要SSD与magento2一起使用

p/s Magento 2 more complicated than Symfony/Laravel/CI (M2 consist Symfony by the way) and can't be so fast as pure frameworks

p / s Magento 2比Symfony / Laravel / CI更复杂(顺便说一句,M2包括Symfony)并且不能像纯框架那么快

#3


1  

2018 Update, Magento 2.2.4

2018年更新,Magento 2.2.4

Vagrant + Windows + Magento2 = disaster. Vagrant + Apple + Magento2 = disaster.

Vagrant + Windows + Magento2 =灾难。 Vagrant + Apple + Magento2 =灾难。

Ubuntu + Magento2 = cooking on gas.

Ubuntu + Magento2 =用煤气烹饪。

Simple modules, e.g. a widget, take many days more than the expected 2-3 hours and it is not possible to remember what you are doing if it takes a minute to open a page, particularly so if you have to clear caches, compile, upgrade or anything else that should take no-time-at-all.

简单的模块,例如一个小部件,比预期的2-3个小时花费很多天,如果打开一个页面花了一分钟就不可能记住你在做什么,特别是如果你必须清除缓存,编译,升级或其他任何东西这应该是没有时间的。

This I have experienced first hand, from working in an office where the options are Mac or Windows. After spending a whole day trying to change the template directive and failing to make one configuration change in 8 hours, I thought about giving it a go on a linux box to see if I had gone mad or if this Vagrant contrivance is as helpful as that drunken bum sleeping rough in the park down the road.

这是我第一手经验,在办公室工作,选择Mac或Windows。在花了一整天试图更改模板指令并且未能在8小时内进行一次配置更改之后,我想在Linux机箱上试一试,看看我是否疯了,或者这个Vagrant的设计是否有所帮助醉酒的屁股睡在路边的公园粗糙。

The aged linux box with anaemic RAM, an old SSD, stock Apache and no fancy cache things completed the task without problem, I was able to switch between developer and production modes effortlessly and get what had taken me days to not do done in minutes.

带有贫血RAM的老式linux机箱,旧的SSD,库存Apache以及没有花哨的缓存功能完成了任务而没有问题,我能够毫不费力地在开发人员和生产模式之间切换,并在几分钟内完成了我几天没做的事情。

The work machine was 8th generation i7, the Vagrant setup was very much someone's baby and a lot of time had been spent building the beast. Yet tectonic plates move faster. Vagrant and virtualisation might be fashionable but it is no use for M2 development. In fact I installed M2 and did all the db and vhost setup for it in less time than it takes for a Vagrant box to build.

工作机器是第8代i7,Vagrant设置是非常有人的宝贝,并且花了很多时间来建造野兽。然而构造板块移动得更快。流浪和虚拟化可能很时尚,但它对M2的开发毫无用处。实际上我安装了M2,并且在比Vagrant盒子构建所花费的时间更短的时间内完成了所有db和vhost设置。

As for performance, since M2 on a basic linux setup is 10x faster than some clumsy Vagrant effort, it is easy to see where the real speed problems of Magento 2 are. If you fire up Lighthouse in Chrome you will see TTFB is absolutely fine but the performance halves if you minify and merge the JS + CSS. This is because M2 has a megabyte of scripts to download. This is the performance killer. If you are working on a Vagrant box then you will never see this and not have the speed to fix it. By fix it I mean write a proper theme that doesn't have nonsense such as jQuery loading on every page.

至于性能,由于基本的Linux设置上的M2比一些笨拙的Vagrant工作速度快10倍,因此很容易看出Magento 2的实际速度问题在哪里。如果你在Chrome中启动Lighthouse,你会看到TTFB绝对没问题,但是如果你缩小并合并JS + CSS,性能会减半。这是因为M2有一个兆字节的脚本要下载。这是性能杀手。如果您正在使用Vagrant盒子,那么您将永远不会看到这个并且没有速度来修复它。通过修复它我的意思是写一个没有废话的正确主题,例如在每个页面上加载jQuery。

For production you need something that scales so you can get the normal speed enhancements going for that, e.g. Redis, opcode caching, Varnish, tweaked php-fpm, tweaked MySQL/MariaDB. If you are developing on Linux then you can test these things on localhost knowing they will work fine on production. With that abomination that is Vagrant you will be dabbling with these optimisations prematurely because you are hoping and praying for a performant machine because you need to get work done. However, in so doing, and with the absence of native speed, you will not get anything done.

对于生产而言,您需要一些可扩展的东西,以便您可以获得正常的速度增强,例如: Redis,操作码缓存,Varnish,调整php-fpm,调整MySQL / MariaDB。如果您正在Linux上进行开发,那么您可以在localhost上测试这些东西,因为他们知道它们可以在生产中正常工作由于令人憎恶的是Vagrant,你会过早地涉足这些优化,因为你希望并为一台高性能机器祈祷,因为你需要完成工作。但是,这样做,并且由于缺乏本机速度,您将无法完成任何工作。

If you don't have a spare machine to put linux on then just go to the local tip, get any PC, shove an SSD in it and you are good to go.

如果您没有备用机器来安装Linux,那么只需转到本地提示,获取任何PC,将SSD推入其中并且您很高兴。

#4


1  

In "developer" mode, all caches were disabled.That why magento become slow. I suggest to enable caches by execute command

在“开发人员”模式下,所有缓存都被禁用。这就是为什么magento变慢了。我建议通过execute命令启用缓存

./bin/magento cache:enable

However, you need to clean cache ./bin/magento cache:clean every time you modify xml files or configurations.

但是,每次修改xml文件或配置时都需要清除缓存./bin/magento缓存:clean。

#5


0  

For production environment:

对于生产环境:

You must use Redis for handle Cache, Full Page Cache et Session (http://devdocs.magento.com/guides/v2.0/config-guide/redis/config-redis.html)

您必须使用Redis来处理缓存,整页缓存和会话(http://devdocs.magento.com/guides/v2.0/config-guide/redis/config-redis.html)

You must use Varnish for HTTP cache built in with Magento (http://devdocs.magento.com/guides/v2.1/config-guide/varnish/config-varnish.html)

您必须使用Varnish内置Magento的HTTP缓存(http://devdocs.magento.com/guides/v2.1/config-guide/varnish/config-varnish.html)

You need to set up production Magento mode. (http://devdocs.magento.com/guides/v2.1/config-guide/bootstrap/magento-modes.html)

您需要设置生产Magento模式。 (http://devdocs.magento.com/guides/v2.1/config-guide/bootstrap/magento-modes.html)

You must use ElasticSearch for search engine, EE only (http://devdocs.magento.com/guides/v2.1/config-guide/elasticsearch/es-overview.html)

您必须将ElasticSearch用于搜索引擎,仅限EE(http://devdocs.magento.com/guides/v2.1/config-guide/elasticsearch/es-overview.html)

You must use PHP 7

您必须使用PHP 7

You may use MariaDB even if it is not supported by Magento 2.

即使Magento 2不支持,您也可以使用MariaDB。

You must use CSS minification and JS minification and JS bundling (which works only on production mode).

您必须使用CSS缩小和JS缩小和JS捆绑(仅适用于生产模式)。

Check the official Magento 2 documentation in order to set up this production configuration.

查看官方Magento 2文档以设置此生产配置。

#6


0  

Try to disable synchronisation with default vagrant sync folder (just comment config.vm.synced_folder in VagrantFile and reload) - it's to slow when need to work with a lot of files...

尝试禁用与默认vagrant同步文件夹的同步(只需在VagrantFile中注释config.vm.synced_folder并重新加载) - 当需要处理大量文件时,它会变慢...

Also in developer mode will be useful to generate static files: bin/magento setup:static-content:deploy and ensure that all caches are enabled: bin/magento cache:status

同样在开发人员模式下,生成静态文件也很有用:bin / magento setup:static-content:deploy并确保启用所有缓存:bin / magento cache:status

If it don't help you can try Magento DevBox tool based on Docker: http://devdocs.magento.com/guides/v2.1/install-gde/docker/docker-over.html

如果它没有帮助你可以尝试基于Docker的Magento DevBox工具:http://devdocs.magento.com/guides/v2.1/install-gde/docker/docker-over.html

#7


0  

A bit late here but i think the answer while working on vagrant / docker is mostly that the I/O of files is terribly slow.

这里有点晚了,但我认为在处理vagrant / docker时的答案主要是文件的I / O非常慢。

My solution was simply do disable the whole shared folder and replace it with a remote project (sftp connection) in PhpStorm. All files are so stored within the virtual machine and don't have to be synced everytime the page needs a reload.

我的解决方案是简单地禁用整个共享文件夹并将其替换为PhpStorm中的远程项目(sftp连接)。所有文件都存储在虚拟机中,每次页面需要重新加载时都不必同步。

The main benefit of course is, that it is amazingly fast while working on developer mode.

当然,主要的好处是,在开发人员模式下工作时速度惊人。

But also there are some minor problems while working with this setup:

但使用此设置时也存在一些小问题:

  • You can't run commands straight from your terminal. You have to ssh into your vagrant for running magento2 cli commands.

    您无法直接从终端运行命令。你必须ssh到你的流浪汉运行magento2 cli命令。

  • After running composer updates you may have to download the whole folder again, because in PhpStorm remote changes are not downloaded automatically.

    运行作曲家更新后,您可能必须再次下载整个文件夹,因为在PhpStorm中不会自动下载远程更改。

#8


0  

If you work in developer mode you need to disable JS/CSS merge, disable xdebug and enable opcache. Feel free to run thes MySQL queries on your dev DB and flush cache. This will increate the site performance in developer mode.

如果您在开发人员模式下工作,则需要禁用JS / CSS合并,禁用xdebug并启用opcache。随意在您的dev DB上运行MySQL查询并刷新缓存。这将在开发人员模式下提高网站性能。

UPDATE core_config_data SET value = '0' WHERE path = 'dev/css/merge_css_files';
UPDATE core_config_data SET value = '0' WHERE path = 'dev/css/minify_files';
UPDATE core_config_data SET value = '0' WHERE path = 'dev/js/merge_files';
UPDATE core_config_data SET value = '0' WHERE path = 'dev/js/minify_files';
UPDATE core_config_data SET value = '0' WHERE path = 'dev/js/enable_js_bundling';
UPDATE core_config_data SET value = '0' WHERE path = 'dev/static/sign';

#9


0  

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

我做了这个流浪者,允许你自定义挂载选项,并具有很好的性能:

  • nfs mount or regular mount
  • nfs挂载或常规挂载

  • directory mount /var/www/magento/app or whole project /var/www/magento
  • 目录mount / var / www / magento / app或整个项目/ 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.

您可以进行快速的magento安装并根据您的工作实践和主机性能来调整参数。

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.

例如,如果主机不支持NFS选项并且性能不佳,则只能安装足以进行开发的app目录。