File access in mounted volumes extremely slow, CPU bound

Hi from Paraguay,

I’m running a Rails app in one container linked to a Postgres DB in another, and yes, with a volume for my source code the app runs really slow averaging almost 2 mins for simple HTTP requests. Without the volume it seems at least as fast as when using docker-machine. By the way, instead of using a volume for my sources, I enable the RemoteSync plugin in my Atom editor.

Following I provide some info about my environment

OS X El Capitan (version 10.11.4)

docker version

Client:
Version: 1.11.1
API version: 1.23
Go version: go1.5.4
Git commit: 5604cbe
Built: Wed Apr 27 00:34:20 2016
OS/Arch: darwin/amd64

Server:
Version: 1.11.1
API version: 1.23
Go version: go1.5.4
Git commit: 8b63c77
Built: Fri Apr 29 14:13:26 2016
OS/Arch: linux/amd64

Version of my Docker app

Version 1.11.1-beta10 (build: 6662)
b4d942b304b7d7d0ee48d96e3b424ccfbcceca89

docker-compose.yml

web:
  image: cnatural_web:latest
  volumes:
    - .:/home/app/webapp
  links:
    - db
  ports:
    - "3001:80"
    - "2221:22"
  environment:
    RAILS_ENV: development
    PASSENGER_APP_ENV: development
    BUNDLE_PATH: /home/app/bundle
    FB_APP_ID: XXXXXX
  volumes_from:
    - bundle

db:
  image: postgres:9.4.4
  ports:
    - "55431:5432"

bundle:
  image: cnatural_web:latest
  command: ls /home/app/bundle
  volumes:
    - /home/app/bundle

My cnatural_web image is FROM phusion/passenger-customizable:0.9.17

WITH VOLUME docker stats

CONTAINER           CPU %               MEM USAGE / LIMIT     MEM %               NET I/O               BLOCK I/O           PIDS
dc9cf20b0f73        0.58%               207.4 MB / 4.143 GB   5.01%               554.1 kB / 215 kB     0 B / 618.5 kB      56
e14d47647570        0.00%               19.78 MB / 4.143 GB   0.48%               107.7 kB / 361.1 kB   0 B / 8.872 MB      7

It takes really long to even start processing the request and strangely - perhaps the symptom - BLOCK I/O both report 0B/xxx.

WITHOUT VOLUME docker stats

CONTAINER           CPU %               MEM USAGE / LIMIT     MEM %               NET I/O               BLOCK I/O             PIDS
04ea0ab1185d        0.58%               435.1 MB / 4.143 GB   10.50%              1.555 MB / 1.237 MB   38.28 MB / 10.76 MB   58
e14d47647570        0.00%               21.54 MB / 4.143 GB   0.52%               125.4 kB / 460.2 kB   266.2 kB / 17.9 MB    7

I hope that this volume slow performance issue can be fixed soon because although the RemoteSync plugin does a good job copying filies via rsync, it’s somehow burdensome when it comes to deal with changing directory structure with git because you have to manually scp the files. Also, you always have to take care of copying some files like Gemfile.lock from container to host.