This is a fairly new feature of Docker for Mac 17.04, and isn't nearly used enough. The 'delegated' flag is the one you want to use. This postpones writes back to the host in order to achieve higher filesystem throughput. Enjoy your modified Docker setup! Hope you experience much better performance as Docker for Mac continues to get better each day. You're right: Docker for Mac and Docker for Windows both run Linux containers in a Linux VM. Virtual machines are supposed to have near native performance. However, if the host machine does not have enough memory to serve the memory requirements of the VM as well as that of the underlying OS (Mac or Windows), then there's going to be performance penalties because of things like swap thrashing and memory balooning. There could be a further slowdown if your host has a slow spinning disk instead of an SSD. So: Assigning more memory to the Linux VM will help only if there is enough memory in the host. The probably is not even usually CPU, memory, or network - it is almost always entirely down to the disk performance. Even then, it's not the disks of the VMs themselves, it's mounting folders from the host onto a VM - because it's not a native filesystem, solutions like NFS exist, different Hypervisors have their own filesystems. Docker for Mac uses a custom one called osxfs to share the host filesystem with the VM it runs. In other words, if you mount anything into your containers from your host machine, you are very likely to see worse performance. If you don't mount anything from the host machine, you are likely to see near-native performance, as long as you haven't run out of other resources (CPU, memory, network). You can read more about osxfs here: Edit: To add to this, you may have realised from what I've just been saying - if you didn't use any host-mounted folders ever, you could actually sync the code into your VM. I've done this before using unison and you can achieve near-native performance then on macOS. Since I did this I believe a tool has been released to handle this automatically for you, but I can't remember what it's called. Media streaming software for mac. I've been using Linux now for about a year and have been loving native Docker without messing around. While still slower than running natively on Linux, there are some mitigations for performance problems for shared folders on MacOS: • If the app in your container creates cache files (like compiled code), define this cache directory as a separate volume and don't export it to your host. This will speed up access of the app to the cache folder • Try different volume caching strategies (default is to always synchronize, which is slow. You might not need that strict guarantees): • Sync code between host and container using instead of shared volumes • You can speed up file sharing by using NFS instead of the native MacOS, like in Never used the latter two myself, although I heard they work well enough for a dev environment. The first two were enough for the MacOS user on my dev team to make the experience less painful. Code runner for mac. Using Linux is definitely the better option for docker. I think it depends on a lot of things. Not all set ups with Docker for Windows are very slow. For example, I moved from running Docker on Linux to Docker for Windows on my dev box and while I did notice a slow down in volume mount performance, it didn't get unusably slow but there's room for improvement. I am using an i5 3.2GHz with an SSD (about 3 years old). The amount of indirection going on with my Windows box is high, yet I'm happy with the performance. • Docker for Windows runs the Docker daemon. • Windows Subsystem for Linux routes its own Docker client to that Docker for Windows daemon. • All of my source code is mounted from an external HD (not SSD) into WSL. • That WSL mounted source code is also mounted back into Docker for Windows. With all of that going on, web applications with hundreds files reload faster than I can move my mouse to click refresh in a browser. Learn autocad for mac 2018 online. Even rails applications process changes and serve requests in 100ms or less in development. The only exception is when dealing with assets. With webpack I load in 1.4mb of Javascript through babel and without any caching it takes around 500ms for it to compile a change. Likewise 250kb of SCSS going through a lot of loaders takes 1.8 seconds without caching or optimizing anything.
0 Comments
Leave a Reply. |