Recent (2020/08) Docker for Mac file access slow problem memo
Summarize what you have investigated.
- Since ancient times, the problem of slow file access between host and container in Docker for Mac has been discussed.
- https://github.com/docker/for-mac/issues/77
- https://forums.docker.com/t/file-access-in-mounted-volumes-extremely-slow-cpu-bound/8076
- Why is it slow on macOS? ↓ It seems that it is written around here (but I have not read it)
- https://web.archive.org/web/20201007205306/https://docs.docker.com/docker-for-mac/osxfs/#performance-issues-solutions-and-roadmap
- To address that issue, the
cached
, delegated
flags were added to the volumes option in 2017. It speeds up file access at the expense of some consistency. Consistency is higher in the order of consistent
(default)> cached
> delegated
.
- https://www.docker.com/blog/user-guided-caching-in-docker-for-mac/
- https://web.archive.org/web/20200611082225/https://docs.docker.com/docker-for-mac/osxfs-caching/
- https://github.com/docker/for-mac/issues/1592
- In the benchmark below,
cached
and delegated
are 2-3 times faster than consistent (default).
- https://www.amazee.io/blog/post/docker-on-mac-performance-docker-machine-vs-docker-for-mac
- However, it is still slower than Linux etc., and there are some unofficial ways to make it faster.
- https://www.jeffgeerling.com/blog/2020/revisiting-docker-macs-performance-nfs-volumes
- Here are various manual settings and NFS mount methods, a gem called docker-sync, bg-sync A container called / docker-bg-sync) is introduced along with the benchmark. Both are twice or more faster than the
delegated
flag.
- On the other hand, in Docker official, a tool (?) Called Mutagen was introduced in Edge release v2.3.1.0 (2020-05-20). It seems that performance close to native will come out.
- https://docs.docker.com/docker-for-mac/edge-release-notes/#docker-desktop-community-2310
- https://docs.docker.com/docker-for-mac/mutagen/
- Benchmark https://github.com/docker/for-mac/issues/1592#issuecomment-634960996
- However, while this has some performance improvements, it has some issues and has been removed in Edge v2.3.5.0.
- https://docs.docker.com/docker-for-mac/edge-release-notes/#docker-desktop-community-2350
- The reason is explained in ↓. It seems that the cache may not catch up, or there is a problem that the subdirectory is not cached (I do not know in detail so I may have misread it)
* https://github.com/docker/for-mac/issues/1592#issuecomment-678397258
- Instead, a filesystem called gRPC-FUSE was introduced in the same Edge v2.3.5.0.
- https://docs.docker.com/docker-for-mac/edge-release-notes/#docker-desktop-community-2350
- Officially says "This has much faster file sharing and uses much less CPU than osxfs" (osxfs is an old (current) file system), but the benchmark posted in the above issue didn't make it any faster.
- https://github.com/docker/for-mac/issues/1592#issuecomment-678411517
- In the above issue, the developer of Mutagen says something like "Mutagen itself can be used even if Docker for Mac is not installed, so please try it."
- https://github.com/docker/for-mac/issues/1592#issuecomment-678489727
- How to use https://mutagen.io/documentation/orchestration/compose
- Many people are dissatisfied with the removal of mutagen, and commented on the issue, such as "I will continue to use Edge release build with mutagen."
- mutagen has been removed as of Edge and there are currently no plans to re-enter stable (although there is a possibility of rethinking and redesigning). gRPC-FUSE will be stable in September. The default is gRPC-FUSE, but you can switch to the old one (osxfs) in the settings.
- Docker for Mac 2.4.0.0 with gRPC-FUSE was released on 09/30/2020
- https://docs.docker.com/docker-for-mac/release-notes/#docker-desktop-community-2400