1
  • My .dockerignore is setup to ignore busy directories, but altering a single file seems to have a huge impact on the run performance.

  • If I make a change to a single, non-dependent file (for example .php or .jpg) in the origin directory, the performance of the next request is really slow.

  • Subsequent requests are fast, until I make a change to any file in the origin directory and then request times return to ~10s.
  • Neither :cached or :delegated make any difference

Is there anyway to speed this up? It seems like Docker is doing a lot in the background considering only one file has been changed?

enter image description here

enter image description here

enter image description here enter image description here

Haroldo
  • 36,607
  • 46
  • 127
  • 169
  • You can now get performance almost as fast as with Linux, using Mutagen. See [this answer](https://stackoverflow.com/a/62136760/1941316). Hope that helps. – Kwadz Jun 02 '20 at 13:38

2 Answers2

0

The .dockerignore file does not affect volume mounts. It is only used when sending context to the Docker daemon during image builds. So that is not a factor here.

Poor performance in some situations is a longstanding known issue in Docker for Mac. They discuss this topic in the documentation. In my experience, the worst performance happens with fs event scanners, i.e. you are watching some directory for changes and reloading an app server in response. My way of dealing with that is to disable the fs event watcher and restart the app server manually when that's needed. (May or may not be practical for your situation.)

The short answer is that you can try third party solutions, or you can accept the poor performance in development, realizing it won't follow you to production (which is probably not going to be on the Mac platform).

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
0

I ran into a similar issue but on Windows. The way I got around it was to use vagrant. Vagrant has great support for provisioning using Docker. In your Vagrantfile set up the shared directory to use rsync. This will copy over the directories on the VM. Docker can access these directories quickly when in memory on the VM.

This is a great article that helped me come to this conclusion: http://blog.zenika.com/2014/10/07/setting-up-a-development-environment-using-docker-and-vagrant/

More information on provisioning vagrant using docker: https://www.vagrantup.com/docs/provisioning/docker.html

More information on vagrant rsync: https://www.vagrantup.com/docs/synced-folders/rsync.html

I hope this helps you as much as it did me.

cbolgiano
  • 72
  • 5