-
-
Notifications
You must be signed in to change notification settings - Fork 595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker for Mac mutagen caching feature (removed) #2278
Comments
@rfay thank you for taking care. Looks promising, still wonder why the OSX FS Api can’t be directly use with a fuse driver from the docker vm. But that’s something the docker team has to deal with. Afaik they did something similar for windows. Awesome, first try looked good. |
Hmm... doubling the disk space usage — thanks for highlighting that. Sadly my Macbook’s disk space is at a premium, so not sure it's worth it for me, especially since I am quite happy with ddev+NFS performance. Must... resist... the urge... to be on... the bleeding edge... ;) |
TIL: |
thanks for the write up of the instructions @rfay ... even though i am short on disk space but i will give it a try anyway on the weekend i suppose. guess with my dated mbp 13" early 2011 setup i am in need of more performance but at the same time it is a good real life test environment aside those latest high powered setups ;) btw in todays dockercon are a few related sessions if anyone is interested: overview of all available sessions: |
This is great! It took ~2:45 min without cache and ~45 sec WITH cache to install Drupal 8. |
It seems ddev import-db is broken.
|
Great catch. Mentioned your catch in docker/for-mac#1592 (comment) It also looks to me like there's a bug in ddev, because it says "Successfully imported database 'db' for d7-site" when it obviously didn't. |
I took a look at the import-db options with an eye to fixing it. #2295 should fix the fact that no error was reported. But ways to fix it:
|
From @djs55 on the docker desktop team:
I'm not sure what this will mean to ddev, whether it helps the problems people hit or not. I'm pretty sure |
There's a new edge release, and there's lots of discussion in docker/for-mac#1592 - anybody is welcome to return to this. I don't think |
The latest version of Docker Desktop for Mac Edge is 2.3.2.0, came out today, see https://docs.docker.com/docker-for-mac/edge-release-notes/ With it I am able to use |
As of 2020-07-31, Docker Edge 2.3.4.0, the strategy outlined here does not work with ddev (you don't get the mutagen syncing at all). Unless Docker changes direction, supporting Mutagen will require explicit code support in DDEV-Local. |
You can use a Place a file named
I'll update the OP with that. |
Having been using this for over a week now, I'll say that I've had zero problems with |
@WidgetsBurritos I'm pretty sure it also relates the the size of the database. The smaller the database, the less likely the problem is to occur. I assume that's why it hasn't happened to me much either, I should test it with a more representative db. |
One of the database files I've been working with is a 921MB. The file is not gzip-compressed, mind you, so I'm unsure if that factors in any way, but it seems to import just fine. |
Well that's absolutely good news! |
It's looking like this Docker Edge feature may not be coming to Docker Stable very soon, or perhaps at all. There are ways to support it without that though. |
Is the mutagen caching too buggy and unreliable to roll it out in docker stable? or are the devs at docker hoping for the virtualization api coming to macos and being able to provide something similar to wls2 on windows since the apple keynote? |
Hey @rfay and @rpkoller! Mutagen developer here (though not involved with the Docker for Mac integration or able to speak for Docker). My impression is that they're still just in something of a testing period, trying to understand if the synchronization heuristics they've chosen will work for a broad enough range of use cases. It's also possible to use Mutagen independently to achieve the same caching setup with much more granular control over synchronization behavior. Basically you create an in-VM Docker volume and synchronize code into it. This can be done manually or as part of an automated setup (and there are a few options for that, e.g. Mutagen's Compose support). I'd like to work on improving Mutagen's scriptability in v0.13, so I'd be happy to have a chat about what sort of design would be helpful to your integration efforts. This might be a more convenient and performant route for specialized integration cases such as yours, even if Docker for Mac does eventually ship this feature outside the edge channel. |
@rpkoller the copy-type integration is so different from any kind of traditional mount that it just causes people confusion. For example, a large file copied into a mounted directory on the host may not appear inside the container for seconds or minutes, and vice versa. It's not actually buggy, it's just a completely different kind of expectation, and that means that if/when they roll it out they are likely to have a lot of support issues on their hands. It's also possible they can rethink how they're doing it and limit that. In my experience, it's far more reliable (as far as not breaking) than our old webcache feature (which was the same idea) from a couple of years ago. But I've seen lots of confusing things happen with it. @havoc-io thanks for checking in! Yeah, even before the docker integration we added a feature to enable direct use, as described in @cweagans https://cweagans.net/2020/04/23/fast-local-development-on-macos-with-ddev-and-mutagen/ - and we've definitely been talking about your new explicit compose support. I think direct use might be actually more appropriate than using the docker approach, because we'd have more control (and more control of people's expectations, because they'd have to be pretty deliberate about using it. A mutagen-syncing approach is absolutely astonishingly wonderful for applications where everything is happening inside the container (like automated testing), and I think we should plan to do that regardless of what happens with Docker. |
The Docker Edge mutagen feature has been removed in Docker Edge 2.3.5.0, so this issue won't be going anywhere any time soon. docker/for-mac#1592 (comment) |
Closing this for now, as the feature is not in Docker edge and won't be in stable. There are at least two good ways to implement mutagen for people who like it.
|
For the record, if Mutagen's built-in Docker Compose support works well enough, I plan to deprecate my custom solution in favor of that feature + some automated way to enable it for a ddev project. |
Very sad to see this feature go away, because volume binds are horrible on Mac OSX. Luckily our services now use the mutagen project yaml file and it is lightning fast. |
Updated 2020-07-31: With Docker Edge 2.3.4.0, this strategy had to be completely changed, so this is an edit.
We need your help testing the new experimental performance feature of Docker Desktop for Mac.
Docker Desktop for Mac has a new experimental performance improvement, mutagen caching. It has some real possibilities for significantly improving DDEV-Local performance on macOS.
The way mutagen caching works is there's a two-way sync happening under the covers (inside the Docker VM and on the host). Changes noted on the mount inside the container get queued for syncing to the host, and changes noted on the host get queued for syncing in the mount inside the container. This means that the mount is not perfectly consistent all the time (the files on the mount inside the container may not be exactly the same as the files on the host until the syncing process catches up). But it allows the system enormous performance advantages: Thousands of files can be created on the mount inside the container without waiting for syncing... but they'll show up eventually on the host (as with a
composer install
ornpm install
.) There's a high cost in terms of storage (double), because all the files that you have in your project(s) have to live on both your workstation filesystem and inside Docker's VM.Here's what we need you to do:
ddev export-db
orddev snapshot
to save away copies of them. All docker images will be lost, but they'll just be downloaded again. And global caches of other kinds (like composer) are also lost, but will just be recreated when needed.ddev config global --nfs-mount-enabled=false && ddev config --nfs-mount-enabled=false
Note that if you had globally been using nfs-mount-enabled you have turned that off.ddev start
your project. You'll now need to load a database from backup withddev import-db
orddev restore-snapshot
if you were coming to edge from stable.ddev exec df -T /var/www/html
. If "Type" is fuse.osxfs, you're using traditional bind-mount. If it's "nfs", it's NFS. If it's "ext4", you're using the mutagen caching.brew install fswatch
Concerns:
3. It's likely that
ddev import-db
won't work for you because of the consistency issues. There are many other ways to import databases.Advantages:
ddev composer install
performance with mutagen is astonishing.Reporting results and problems
You can report results here as they relate to DDEV-Local, but we really want good information to get back to the Docker team. Please report any results or problems on the docker/for-mac issue
Casual performance results
I did a minor study of two kinds of behavior with regular docker bind-mounting, NFS mounting, and mutagen.
The two tests are
ddev composer install
with all composer caches already warmed (no downloads). You'll note that mutagen caching absolutely kills this one. The reason is that all updates take place inside the container and then are cached for presentation on the host.The text was updated successfully, but these errors were encountered: