-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bind mount performance really slow using JEST testing framework #1358
Comments
It's known issue ... Hopefully docker-sync is using volumens now and You may use it as -v source argument |
@MaximeHeckel Thanks for the easily reproducible performance test case. Looking at some basic access statistics, it appears that whatever is executed from I also see that the access is highly parallel (up to 6 file system operations outstanding simultaneously). Perhaps surprisingly, this workload performs better with 1 vcpu allocated to Docker for Mac compared to 4 with test system-reported time of 5s (vs 6.2s) and end-to-end time of 98s (vs 132s). We've been investigating this issue for several months (in parallel to other work) and the cause is a combination of the Linux scheduler, thread migration policy, and HyperKit interprocessor interrupt overhead. We have some modifications to Linux configuration and our in-VM thread use which may alleviate this multiprocessing bottleneck but those changes require more validation before being deployed which is currently prioritized below other performance improvement work. What version of macOS are you running? The file system team has some improvements to performance nearing release which may help with this use case so I'm going to leave this issue open to track improvement of your usage. Thanks for your report! |
@dsheets Yes there's a way to run the test without the watch mode
I ran it in non watch mode in docker and here are the results:
Maybe you'll get more info from this. I'm running macOS Sierra 10.12.3, but I had this same issue on 10.11 as well. |
I'm having the same issue. Running inside of docker for mac my jest tests take 72.95 seconds and outside of docker the tests take 18.754 seconds. |
In my opinion, maybe the storage strategy docker used causes the problem. When i run |
Issues go stale after 90d of inactivity. Prevent issues from auto-closing with an If this issue is safe to close now please do so. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
In-case it helps anyone, I managed to improve the performance situation when using docker-compose by adding an extra volume for
After doing this the speed went from 17 seconds (for 3 tests) to about 3 seconds. I am running macOS 10.13.4 and using Docker 18.03.1-ce. |
@LondonAppDev Yes! This! Don't need the host machine's node_modules folder in the container anyway ( especially if the host machine is a different kernel than the container) |
Thanks for sharing @MaximeHeckel. Can you please share with the development community the modifications to Linux configurations and any possible changes to the configuration for VMs as soon as they become available. We know how the validation process works with some performance issues taking priority over others. Please hit us back at this posting as-soon-as the information becomes available. Thanks in advance. I have a MacOs, version 12.6.3. I would like to have that information specific to my operating system. |
@clmsnskr without node_modules mounted, how are you avoiding errors from missing modules in your tests? |
@cdomigan in my setup, the node modules are installed when the docker image is built, and to install them I use |
I just tried it and it says : sh: jest: not found I also use docker-compose and alpine node image. Maybe I should install dependencies during the build process. |
It's something related to jest multi thread. Change your docker to use only one CPU at time and then run the tests again. My tests went from 14s to 3s |
@fabioelizandro is correct. There is a way to keep global docker configuration as it's. |
The only thing that has sped up the tests for me was using a named volume on the node_modules folder.
|
When I use an anonymous or named volume as described at #1358 (comment) or #1358 (comment) the resulting node_modules directory inside the container is owned by root instead of the node user and isn't writable by the node user. What am I missing? |
Closed issues are locked after 30 days of inactivity. If you have found a problem that seems similar to this, please open a new issue. Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. |
Description
I'm trying to leverage docker to be a the core of some frontend development flow. To do that I'm trying to run some code from a local folder inside a
node:7.4-slim
container by mounting the folder in a volume. In general file watching and serving files works as expected and doesn't have any performance hit from the volume mounting, but running unit tests with the JEST framework (https://facebook.github.io/jest/) is extremely slow.An issue has been opened a few months ago on the JEST repository but I think opening one here might give the core team a better idea of the problem we're facing.
Link of the issue
Steps to reproduce the issue:
npm
installed on your machine runnpm install -g create-react-app
create-react-app test && cd test
docker run --rm -v $(pwd):/app -w /app node:7.4-slim bash -c "npm install && npm run test"
npm run test
Describe the results you received:
To run one simple unit tests it takes more than 7s
Describe the results you expected:
In local the performance are really fast here's the output of the test task:
In local it takes only 1s
Output of
docker version
:Output of
docker info
:I'm running the previously described steps on my MacBook Pro 2015 13 inch i7 16GB of memory on Docker for Mac
The text was updated successfully, but these errors were encountered: