Closed dimasnake closed 1 year ago
Thanks for reporting. The volume mounts are implemented using a SMB share mounted over the guest/host network.
Out of curiosity, what's your development use-case that requires greater than 20 MB/s transfer-rate when using volumes?
I use docker for local web development. I have nginx, php-fpm, mysql containers. Speed website pages load very slow 5-10 sec.
It is possible to encrease volumes speed?
I have same problem.
Inside container :
root@63d3c3f00862:/# dd if=/dev/zero of=test.dat bs=1024 count=100000
100000+0 records in
100000+0 records out
102400000 bytes (102 MB) copied, 0.208075 s, 492 MB/s
Insidde container share folder :
root@63d3c3f00862:/var/lib/mysql# dd if=/dev/zero of=test.dat bs=1024 count=100000
100000+0 records in
100000+0 records out
102400000 bytes (102 MB) copied, 11.572 s, 8.8 MB/s
Docker info :
PS C:\Users\????\Docker> docker info
Containers: 4
Running: 4
Paused: 0
Stopped: 0
Images: 11
Server Version: 1.12.3
Storage Driver: overlay2
Backing Filesystem: extfs
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 4.4.27-moby
Operating System: Alpine Linux v3.4
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.919 GiB
Name: moby
ID: DBIQ:SFE4:ZUSS:AEDJ:4KJC:ODIJ:W4L7:33D7:QUB7:OE4R:YEIE:UANK
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
File Descriptors: 41
Goroutines: 78
System Time: 2016-11-02T12:20:15.4120124Z
EventsListeners: 1
Registry: https://index.docker.io/v1/
WARNING: No kernel memory limit support
Experimental: true
Insecure Registries:
127.0.0.0/8
Docker volume inspect :
PS C:\Users\????\Docker> docker volume inspect 7c27e585d8d4f55c34a34f6a47d5c0687f0851fc55765b096183f6ee327ea609
[
{
"Name": "7c27e585d8d4f55c34a34f6a47d5c0687f0851fc55765b096183f6ee327ea609",
"Driver": "local",
"Mountpoint": "/var/lib/docker/volumes/7c27e585d8d4f55c34a34f6a47d5c0687f0851fc55765b096183f6ee327ea609/_data",
"Labels": null,
"Scope": "local"
}
]
Docker compose :
version: "2"
services:
mysql:
image: mysql:latest
volumes:
- ./mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE=database
- MYSQL_USER=user
- MYSQL_PASSWORD=password
ports:
- "3306:3306"
php:
build: ./php
image: php:fpm
ports:
- "9000:9000"
links:
- mysql
nginx:
build: ./nginx
image: nginx:latest
volumes:
- ./nginx/website.conf:/etc/nginx/conf.d/website.conf
ports:
- "80:80"
links:
- php
phpmyadmin:
image: phpmyadmin/phpmyadmin
environment:
- PMA_HOST=mysql
- MYSQL_USERNAME=user
- MYSQL_ROOT_PASSWORD=password
ports:
- "8181:80"
links:
- mysql
Is it possible to use NFS of other file sharing system ?
Same usecase and behavior for me.
@friism One of the solutions would be to allow modification of rsize&wsize parameters of smb mount. PHP projects usually consist of hundreds of small files (which have to be loaded on every request) and large rsize degrades performance for this use case.
@dimasnake Try beta 21 if you have installer, performance is much better.
@fmasa I don't have the installer. Where I can download 21 beta?
Here is a beta version of Docker for Windows but really beta 21? The latest beta has the version tag 2016-11-10 1.12.3-beta30
.
@SaschaNaz Yes. Take a look at the end of the tag (beta30
)
@dimasnake @SaschaNaz
I found it! Build 5971 is beta21 https://download.docker.com/win/beta/1.12.0.5971/InstallDocker.msi
Gonna restart my machine and try it.
Can't get it working. Returned to latest beta (30.1). So frustrating, performance at work on Ubuntu is almost ten times better, while having older hardware.
I read in another issue, that installer auto-updates to latest version. :/ So once you updated, you're stuck with that version.
@fmasa @dopee No difference in beta 21 and 30.
This issue has is more appropriate name then #188
There is also alike issue in docker for mac: https://github.com/docker/for-mac/issues/77
I also experience this for example with git
, when I attach as volume some folder and make git
operations on it, with quite large code base speed of operation is significantly slower then on dev machine.
To reproduce it you may just take some image with GIT installed and attach some big repo and try do do git status
.
Facing this issue on symfony app developing.
@dimasnake Are you sure you have beta 21 installed? I found out that installer auto-updates to latest version no matter what.
@friism Is there any roadmap for this issue?
@fmasa I disable auto-update. I have 1.12.0-beta21 (build: 5971). You have in 21 beta performance better? Show output if this command dd if=/dev/zero of=test.dat bs=1024 count=100000
inside docker container.
@fmasa we're aware of the problem. Note that volume I/O performance will likely always be slower than pure in-container performance and pure on-host performance because the host-mounted volume filesystem is mounted over a network.
We're interested in making that overhead as low as possible, of course, but we're not keen on adding a lot of toggles that users have to change depending on what software they happen to be running in containers right now.
@friism Some performance hit in mounted volumes is expected, but it for this particular use case it's just too much for DfW to be usable on daily basis. I don't see way to optimize smb shares w/o some sort of toggles. Different stacks have different requirements. Why don' you give an option to tweak some parameters in config files if not in GUI? You're cutting not unsignificant part of community out of DfW, because the only viable workaround right now is Docker Machine or some nasty hacks. I don't want to flame nor hate, just trying to give you some feedback from PHP world :)
Is there any ETA?
@xdrew we're scheduling work on performance improvements in the first quarter of 2017.
@friism if it helps, the biggest difference I've been able to see in my two environments is down to two things: cpu or hard drive i/o (especially ssd vs hdd). I've been having this problem a lot in my work computer (fairly new i7, but an hdd). At home I have a slightly better i7 and an ssd and it's much faster.
Would love to see a fix for this as it's a major blocking issue in getting Docker for Windows at parity with Linux.
Beta39 released this week has significant performance improvements. We're working on making it faster still.
I tested on 1.13.1-rc1-beta40 (9961) The speed inside the container is now faster
root@fb3066573fe7:/var/www# 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.36649 s, 74.9 MB/s
But loading pages of local web site has become very slow - 44 seconds.
But still terrible performance with Symfony + Nginx + MySql, 11 seconds for blank page.
Same problem here. image: iamluc/symfony super SLOW
I have the same here with my development Node server. It's basically unusable and I have ceased using docker.
To those with performance issues in php applications: Is the xdebug module loaded in php.ini? I notice a big performance improvement when running php applications when I don't load the xdebug.so extension: ;zend_extension=xdebug.so
@nbjohan x-debug always slows it down no matter how you run your application (docker/vagrant/plain/etc.).
Same for me Osx Sierra 10.12.4
Docker Version 17.03.0-ce-mac2 (15657) Channel: beta 32de842512
(but was slow always). I am frontend developer there, so I use php only as passive backend without active development, but still requests takes around 3+ seconds. We have x-debug turned off.
On other hand in my other project I actively use Ruby on Rails and it is fast as on native system.
Is there any workaround for that, how to speed it up?
Adding a +1, I was hoping to use Docker to back a dev environment with windows tools, but transfer speed is sometimes slower than downloading from the Internet :)
Having this issue with pdf generation, using pdftk
to fill pdf's with data. (So X-Debug isn't the cause)
In a host shared volume this takes 1m 10s ,
while the same action with the input files moved to /tmp/
needs just 2s.
Docker Version 17.03.0-ce
on Windows 10 Home
@schovi You probably are looking for the mac version of this issue: https://github.com/docker/for-mac/issues/77
Also experiencing significant lag with shared folders in a Node container, to the point of it being unusable. Host system is Windows 10 Pro.
Having the same issues on Windows, but I don't think that this is something related to Docker or something that they have to fix. We have multiple dev setups in our company, and no matter what you do, even with Docker/VBox/etc if you have your code on the host and mount it on your VM/container/whatever, the performance will always be bad with web apps, especially with the ones that use a lot of small files like PHP (we use Symfony mostly). On a Linux host everything is fine, but on Windows it's not usable. The only thing that you can do, and this is actually working for us, is to mount the other way around. We set up a Samba share on the VM and then map it as a network drive in Windows. It depends also on what IDE you use, but with Jetbrains usually everything works fine, it might hang for a while while indexing, but it's only a few seconds.
Also automatic SSH upload in PHPStorm (Jetbrains) is possible, if combined with an host-sharing (e.g. /data/:/data/
I'm not sure I agree that this is an unfixable problem just because there are meandering pathways around it.
@luckydonald Can you explain to me how to do this ? Is there a way to do automatic upload in a container with PHPStorm ?
It wasn't always this slow; I remember v1.12 and v1.13 being very fast and not noticeably different than if I ran my Node server on my host. Unfortunately, it seems Docker doesn't keep a repository of old versions publicly available and I cannot roll back to test.
Can also confirm. It's impressive how slow it actually is. On Ubuntu (with same docker-compose file and project, on the same machine, booting off same SSD), i can view a vanilla Prestashop 1.7.1 frontpage in about 0.5 seconds.
On Windows 10 with latest docker (at time of writing), it takes about 20 seconds to load, if not more (at least 40 times slower).
Even though i could build/automate a container with the application code directly inside it, that's not suitable for my use-case (and i need the data in a local volume for other purposes).
Gotta stick with dual booting into Linux for now.
As a workaround, we are now trying to have unison (permalink) move my files into the VM, and just share that folder into the container.
____________ ____________________ ____________________
| | | | | |
| Win 10 | | Docker VM | | Docker Container |
| | unison | | docker | |
| ./ <==============> /sync/project1 <=============> /path/bla |
| | sync | | volume | |
|__________| |__________________| |__________________|
Something like --volume /sync/project1:/path/bla
in docker.
This way it will now slow down the folder as It doesn't need to sync with windows for actually running. Unison will update changes independently.
ETA for resolution please ?
Any news about this issue? I've noticed Docker for Mac has consistency parameters (delegated, cached...) within volumes and it speeds up volumes significantly.
We're not working on further improvements at the moment.
Microsoft is adding native Linux container support to Windows and if it's good, I suspect that Docker for Windows will transition to using that feature instead of the current approach. We'll be testing the bind-mount volume performance of that solution as soon as we get our hands on Windows insider builds.
Details: https://thenewstack.io/finally-linux-containers-really-will-run-windows-linuxkit/
A potential workaround for windows/mac users can be Docker-Sync
@friism That's great, but from what I understand it wouldn't improve the situation with Windows containers (and porting Windows applications to Linux is a lot of work).
@masaeedu this issue is about the performance of volumes bind-mounted from a Windows host into a Linux container.
If you're seeing performance problems with volumes mounted from a windows host to a windows container, please open a separate issue
Same issues with symfony. When I share volumes with vmware access times are way faster, maybe use their approach.
If you're interested in running Docker on Windows without dual booting and having native Linux speeds then you may want to read and follow this free screencast guide on setting up vmware:
I've been doing this for years on a Windows box and develop full time. It works really well.
Complex Rails apps with hundreds of assets load just as fast as they do with native Linux. My code editor and everything else runs super fast and you don't need to screw around with horribly slow network based mounts because all of your code (and Docker) will be living in Linux.
Here's the cliff notes:
Until DfW's mount performance along with WSL gets usable for real world web development I'm afraid this is the only sane solution we can do as Windows users who want to develop and run Linux based services but still require running certain Windows apps that have no Linux counterpart.
It's been a while since I participated in this thread, but an update:
A huge number of these problems sort of go away provided that you operate on a modern SSD. I've built a few machines now with an SSD, DDR4 ram, and a 6700k i7 cpu, and writing/reading to volumes is really not a major issue anymore. I'm not doubting that it can be faster, but most of the apparent problems go away. At this point I refuse to use docker for windows on anything other than that setup as a minimum.
@janhartigan, these are good points and I think you're absolutely right...for most apps/systems/setups.
I came to this thread running such a modern SSD setup. However, the application my team works with for our clients is monolithic and not very optimal. The pages take between 5-10 seconds to load rather than a full minute as reported here (or worse with this app).
Regardless, for us, 5-10 seconds is just too slow for development compared to running the app on the dev machine directly. It's a PITA to setup without Docker to help there, but it's the reality until LinuxKit is fully baked. :-\
Expected behavior
File access in volumes should be comparable to access times in non-volumes, similarly to Linux installations of docker
Actual behavior
File access in volumes is many times slower than on non-volumes.
Information
Version: 1.12.3-beta29.2 (8280) Channel: Beta Sha1: 902414df0cea7fdc85b87f0077b0106c3af9f64c Started on: 2016/11/01 21:19:46.408 Resources: C:\Program Files\Docker\Docker\Resources OS: Windows 10 Pro Edition: Professional Id: 1607 Build: 14393 BuildLabName: 14393.351.amd64fre.rs1_release_inmarket.161014-1755
Steps to reproduce the behavior
Get on the commandline of a lightweight docker container
and mount a volume:
In 9 times slower.