Docker performance on Mac
Docker performance on Mac is infamous esp. on larger applications. But what about different hypervisors?
Status quo of Docker Desktop1
There are 4 options to run Docker on macOS:
- Docker Desktop1
- VirtualBox
- VMware
- Parallels
Without further ado, Docker can not achieve near-native experience on any of them. Not at least on a legacy Rails application that runs some 30 locales, 19 GB of content and 1000+ queries per page. It takes ~1 min to reload a page on such system.
Performance improvements for Docker Desktop1
To improve, you can go for things that are normally not done on development environment:
- Add rails-dev-boost gem
-
Enable caching in
config/environments/development.rb
:config.cache_classes = true
On Rails 3, this would get the speed up by 3x.
Now, after some testing with rack-mini-profiler, the numbers for the 4 hypervisors stack up as follows:
Docker’s performance problems on Mac are not new. There’re multiple topics on forum and some of them have remained unanswered for long, e.g. File access in mounted volumes extremely slow, CPU bound.
Update October 2020
Despite Docker for Mac being rebranded to Docker Desktop since this post was made, performance problems have remained. Debate is active in File system performance improvements feed on GitHub.