Docker4drupal: Speed on OS X

Created on 21 Jul 2016  路  19Comments  路  Source: wodby/docker4drupal

I've been experimenting with the Docker for Mac beta and had set up something similar with persistent database storage using the OS X file system. I haven't tried your version yet but I was wondering how you find the speed? On my set up it was unusable for Drupal development.

I've had to go back to a Parallels based VM running boot2docker and NFS for file sharing. This makes for a nice speedy set up but I can't use the local filesystem for database storage due to permissions issues.

help wanted

Most helpful comment

Here is the updated link https://docs.wodby.com/stacks/drupal/local/#docker-for-mac

All 19 comments

From what I know the older Docker version (<1.12) used virtualbox with slow vboxfs. The new docker app uses xhyve, which is much faster. Make sure you're using the new 1.12 version of Docker which actually is still in beta.

In my experience the new Docker for Mac beta is still unusable for Drupal development but I'll give your set up a go and see if there are any improvements. The bottleneck is the filesystem and hosting the database locally is a killer. Using NFS is a lot faster but the beta doesn't support it.

I'm only installing Drupal using docker4drupal, but can already see that it's pretty slow, comparing to drupalvm (vagrant + parallels).
Otherwise, installation and setup is a breeze and have a great potential!

@artemkolotilkin could you give us more details, what is your docker version? As I mentioned above the performance should be much better with docker 1.12+

Sure. I'm on OSX 10.11.6, using Docker version 1.12.0-rc4-beta20 (build: 10404). Have 2 separate Drupal 8 sites running:

  1. Vagrant - Status report page opens in 1.2 sec
  2. Docker - Status report page opens in 5.1 sec

Let me know if you need more info!

@artemkolotilkin it's possible xdebug issue. I've integrated flag to enable/disable xdebug.
Could you check it again? Pay attention on "PHP_XDEBUG_ENABLED: 0" env var in the compose file.

I've had a bit of time to test this and so far I'm impressed with the speed. Its pretty fast on a new D8 site, whether PHP7 or 5.6 is used and whether xdebug is enabled or not. I'm going to do some development on an existing D7 site and see how the speed goes with that. Great work!

@PavelPrischepa I've just done another try with latest version and PHP_XDEBUG_ENABLED set to 0 and can definitely see an improvement, although it's not significant. On a vanilla Drupal 8 install Status report page opens in 3.8 - 4.2 seconds which is less than 5 seconds it used to be, but still far slower comparing to Vagrant (1.2 seconds).

There's a very long thread at Docker forums.
In short, mounting host folders (code/database) leads to unacceptable performance.
I haven't tried docker4drupal but I can't see how it could be different in this regard.
It seems that the only viable solution is some kind of rsync (host to guest) or unison (bidirectional) syncing. I'm using docker-sync.
That's an OK solution for the code but I doubt you can use it for DB so I just use a separate named (persistent) volume for that. This way Drupal is at least 5-10 times faster.

Yes, there are a few performance issues with osxfs, check out this post from a Docker Inc engineer to learn more. Docker sync looks interesting, I will check it out.
Also, consider using redis/memcached to decrease db requests.

on OSX and Windows docker is slow, it's because it runs on VM instead of Linux Container. For Linux, it should be faster

It's not too do with the VM, it's the filesystem osfx which is slow. There is plenty of documentation about it. On Linux this isn't an issue

Is there any progress on this issue? I would like to use docker4drupal, but it's just not performing OK.

I don't think the issue is with docker4drupal, its with docker for mac. There are numerous forum posts about the speed issues on the docker forums. The reality is that it'll take a long time to get a performant filesystem for docker for mac as the earlier link in this thread indicates.

@fabianderijk @tanc Developers with OS X in my company are currently working with dinghy https://github.com/codekitchen/dinghy it's not perfect but it's faster than docker for mac, maybe you can give a try.

I've added instructions how to fix performance on macOS with the help of docker sync project http://docs.docker4drupal.org/en/latest/macos/

Closing this issue due to no activity, the workaround via docker-sync has been presented. I know it's not ideal.

@csandanov might want to reopen this since "docker4drupal.org" has been domain squatted

Here is the updated link https://docs.wodby.com/stacks/drupal/local/#docker-for-mac

Was this page helpful?
0 / 5 - 0 ratings