Docker Community Forums

Share and learn in the Docker community.

File access in mounted volumes extremely slow, CPU bound


(Devildriver) #41

Unfortunately, having the same problem, application is unusable cause it runs all commands very slow. When i used docker-machine on mac, i manually mounted shared volume via nfsd and it fixed the problem. I use docker-compose to build everything like this:

data:
      ...
      volumes:
        - .:/var/www

And run it like: docker-compose up -d.
I hope this problem will be fixed in the future releases. for now have to switch back to docker-machine.


(Eugenmayer) #42

Why are most of you all switching back to docker-machine / dockertoolbox due to this issue?
The issue with docker-mac-dev and sorts are, they make to many assumptions (like forcing to user VirtualBox). But this is not needed

For this issue to be fixed no matter you use docker-machine (virtualbox or fusion or paralells) or docker for mac, simply:

If you want to resync on changes automatically, use Filewatcher ( shell or ruby gem, what suits you best ) and thats basically it. This way, you are independent of the solution like VirtualBox, Fusion or docker for mac.

This solution is 2 times faster as NFS is.

Rsync with docker for mac is pretty nice, at least for my purpose. Though, i hope they fix this natively to remove rsync as an extra-dependency to the stack


(Lennard westerveld) #43

With the new beta still a problem:

Version 1.11.1-beta11 (build: 6974)
37559e5f6acd56a4810963acc7001e88f2d88017
sh-4.1# time dd if=/dev/zero of=test.dat bs=1024 count=100000
100000+0 records in
100000+0 records out
102400000 bytes (102 MB) copied, 26.5737 s, 3.9 MB/s

real	0m26.579s
user	0m0.190s
sys	0m1.630s

(Sadokf) #44

With Docker for mac:

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: Tue May 10 10:39:20 2016
OS/Arch: linux/amd64

time dd if=/dev/zero of=test.dat bs=1024 count=100000

100000+0 records in
100000+0 records out
102400000 bytes (102 MB) copied, 38.0505 s, 2.7 MB/s
real 0m38.057s
user 0m0.170s
sys 0m2.030s

With Docker machine

time dd if=/dev/zero of=test.dat bs=1024 count=100000
100000+0 records in
100000+0 records out
102400000 bytes (102 MB) copied, 1.71642 s, 59.7 MB/s

real 0m1.721s
user 0m0.000s
sys 0m0.100s


(Vaughansharman) #45

I am experiencing the same issues with 1.11.1, happy to provide specifics if useful, but they somewhat mirror those above


Plans to open osxfs?
(Fuerst) #46

Looks like virtio-9p (VirtFS) is being added to xhyve. That could be the way to go.


Generalized remote file sync
(Ahansson89) #47

Was excited to join the beta today because of this:

“Volume mounting for your code and data: volume mounting and data access just works, including file change notifications (on Mac inotify now works seamlessly inside containers for volume mounted directories). This enables edit/test cycles for “in container” development.”

Not so excited after trying the beta because of the slow mounted volumes.


(Davidcrty) #48

Hello from Paris,

I’m having the same issue with my Symfony 3 application.

The page take more than 30sec to be generated. With my MAMP server it took less than 1sec.
Here is my config :
OS X El Capitan v10.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: Tue May 10 10:39:20 2016
OS/Arch: linux/amd64

And my docker-compose.yml :
version: '2’
services:
db:
image: mysql
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: my_db
MYSQL_USER: root
MYSQL_PASSWORD: root
php:
build: ./php-fpm
expose:
- "9000"
volumes:
- ./symfony:/var/www/symfony
- ./logs/symfony:/var/www/symfony/app/logs
links:
- db
nginx:
build: ./nginx
ports:
- "8080:80"
links:
- php
volumes_from:
- php
volumes:
- ./logs/nginx/:/var/log/nginx


(Michaël Perrin) #49

Hi @davidcrty,

There is an other thread concerning very slow Symfony apps: How to speed up shared folders

As shown in my last posts this is due to the vendors (much more than shared cache and logs folders to my surprise). So for now I move the vendor directory out of the shared directories.

I wish I could develop Symfony apps normally using Docker too!

Michaël (from Paris too)


(Sébastien HOUZÉ) #50

Hi @michaelperrin & @davidcrty yup, moving vendor dir out of shared dirs is an improvement (through a docker named volume it’s pretty cool for local dev if you plan tu run multiple instances of the same container).

But… even with that I can say that my behat test suite is about 4 times slower than on a virtualbox docker machine with some NFS mount.


(Guillaume Cauchon) #51

Has anyone tried the latest update released yesterday?

https://beta.docker.com/docs/mac/release-notes/


Beta 12 Release (2016-05-17 1.11.1-beta12)

Upgrades

  • FUSE 7.23 for osxfs

Known issues

  • Docker.app sometimes uses 200% CPU after OS X wakes up from sleep mode. The issue is being investigated. The workaround is to restart Docker.app.


(Lennard westerveld) #53
Version 1.11.1-beta12 (build: 7528)
4151b0fc71e51fb8e551d0a1870893ac99a379bc
sh-4.1# time dd if=/dev/zero of=test.dat bs=1024 count=100000
100000+0 records in
100000+0 records out
102400000 bytes (102 MB) copied, 25.1831 s, 4.1 MB/s

real	0m25.188s
user	0m0.140s
sys	0m2.150s

(Misterdai) #54

Haven’t run specific tests but have still found beta12 to be extremely slow with mounted volumes. To the point where I’ve stopped using it, think I’ll retry with each new release and stick with alternatives until then.


(Rens Admiraal) #55
OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.11.1-beta12
Running diagnostic tests:
[OK]      Moby booted
[OK]      driver.amd64-linux
[OK]      vmnetd
[OK]      osxfs
[OK]      db
[OK]      slirp
[OK]      menubar
[OK]      environment
[OK]      Docker
[OK]      VT-x
Docker logs are being collected into /tmp/20160518-222735.tar.gz
Most specific failure is: No error was detected

time dd if=/dev/zero of=/var/www/test.dat bs=1024 count=100000
100000+0 records in
100000+0 records out
real	0m 32.85s
user	0m 0.22s
sys	0m 2.13s

(b.enoit.be) #56

Not only the file access is slow but you can also definitely spot a change on frameworks using lots of files to render pages.

For example, a Magento run with a Apache + PHP - FPM + Percona stack is visually way lot slower on page load when the folder are mounted on the host VS when the folder is only stored as a Volume in the VM.

AB benchmark comparison:
With mounted folders:

$ ab -n10 -c10 http://magento.dev/
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking magento.dev (be patient).....done


Server Software:        
Server Hostname:        magento.dev
Server Port:            80

Document Path:          /
Document Length:        0 bytes

Concurrency Level:      10
Time taken for tests:   31.205 seconds
Complete requests:      10
Failed requests:        7
   (Connect: 0, Receive: 0, Length: 7, Exceptions: 0)
Total transferred:      235984 bytes
HTML transferred:       232603 bytes
Requests per second:    0.32 [#/sec] (mean)
Time per request:       31204.892 [ms] (mean)
Time per request:       3120.489 [ms] (mean, across all concurrent requests)
Transfer rate:          7.39 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1   0.1      1       1
Processing:     2 17343 12491.7  23129   31203
Waiting:        0 17340 12491.0  23127   31195
Total:          3 17343 12491.8  23129   31204

Percentage of the requests served within a certain time (ms)
  50%  23129
  66%  23259
  75%  24196
  80%  30541
  90%  31204
  95%  31204
  98%  31204
  99%  31204
 100%  31204 (longest request)

With volume only on the VM:

$ ab -n10 -c10 http://magento.dev/
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking magento.dev (be patient).....done


Server Software:        Apache/2.4.20
Server Hostname:        magento.dev
Server Port:            80

Document Path:          /
Document Length:        33229 bytes

Concurrency Level:      10
Time taken for tests:   1.605 seconds
Complete requests:      10
Failed requests:        0
Total transferred:      337120 bytes
HTML transferred:       332290 bytes
Requests per second:    6.23 [#/sec] (mean)
Time per request:       1605.108 [ms] (mean)
Time per request:       160.511 [ms] (mean, across all concurrent requests)
Transfer rate:          205.11 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       1
Processing:   396  952 451.4    952    1604
Waiting:      394  951 451.2    951    1604
Total:        396  953 451.4    952    1605

Percentage of the requests served within a certain time (ms)
  50%    952
  66%   1057
  75%   1395
  80%   1561
  90%   1605
  95%   1605
  98%   1605
  99%   1605
 100%   1605 (longest request)

That is indeed nearly 25 times quicker without the files mounted on the host if we consider the median time :unamused:
On OS X: version 10.11.5 (build: 15F34) & Docker.app: version v1.11.1-beta12


(Christoph Kluge) #57

The same applies to me with latest beta.

Running one of my projects natively runs pretty fast ~200ms per request but as soon as I add a shared volume the response time goes towards 30s+

OS X: version 10.11.4 (build: 15E65)
Docker.app: version v1.11.1-beta12
Running diagnostic tests:
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x


(Kulja) #58

I have the same problem.

I think I can make it better by not including node_modules and tmp folders (it is an ember project). Is there a way to exclude some folders from volumes? (.dockerignore didn’t work)


(Andres Ivanov) #59

Experiencing same problem running Rails apps with mounted folder.

Here is some additional info, hope it helps to debug, find the problem:

  • Macbook Pro - OS X El Capitan v10.11.5
  • Docker app version - Version 1.11.1-beta12 (build: 7528)

I also tried test posted by @tomfrost , here’s the output:

Docker Mac Beta:

/Users/andres1 # time dd if=/dev/zero of=test.dat bs=1024 count=10000
10000+0 records in
10000+0 records out
real	0m 3.44s
user	0m 0.05s
sys	0m 0.30s

Default docker-machine from Toolbox, Oracle VM, 2GB mem, nothing modified:

/Users/andres1 # time dd if=/dev/zero of=test.dat bs=1024 count=10000
10000+0 records in
10000+0 records out
real	0m 0.50s
user	0m 0.00s
sys	0m 0.31s

Default docker-machine, Oracle VM, mounted /Users using NFS:

/Users/andres1 # time dd if=/dev/zero of=test.dat bs=1024 count=10000
10000+0 records in
10000+0 records out
real	0m 0.07s
user	0m 0.00s
sys	0m 0.03s

(Luis Contreras) #60

Check now with version 1.11.1-beta13, is now fast!! I test with a Symfony project and now is 3x faster


(Mvdstam) #61

I can confirm this; Beta13 made things a lot faster. An empty Laravel 5.1 project used to load in 4000ms seconds with Beta12, now it’s around 1200ms.

Still not fast, but definitely getting there. Really nice to see the Docker team is making tremendous progress here!