Docker performance on Mac is infamous esp. on larger applications. But what about different hypervisors?
There are 4 options to run Docker on macOS:
- Docker for Mac
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.
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, e.g. File access in mounted volumes extremely slow, CPU bound, will soon celebrate its 1-year anniversaries. Unfortunately so.