A story about speeding up unittest on Docker for Mac

Overview

The docker environment I made was too slow, so I speeded it up

As conclusion Do not run a lot of reads and writes on the volume mount Was the most effective

Premise

environment

--MacOS Mojave version 10.14.6

unit test contents

  1. Check out to the specified branch with git
  2. Package installation with pip
  3. Package installation with composer
  4. Format check by submitting sql file to DB
  5. Input test data to DB
  6. php code format check
  7. php unittest (with DB/Redis/Memcached access)

effect

When run on the host machine: 20 minutes Before efficiency: 1 hour After efficiency: 20 minutes

counter-measure

Added delegated/cached to volume mount

https://docs.docker.jp/docker-for-mac/osxfs-caching.html

File access set to volume mount seems to be very slow in docker for Mac It seems that it is an option to speed up instead of ensuring consistency between the host machine and the container.

I couldn't speed it up enough to experience it.

Stopped passing huge files to volume mounts

Because the project code managed by git is huge COPY to container instead of setting to volume mount

This makes unittest much faster It's not much different from running it on the host machine

Conclusion

Do not run a lot of reads and writes on the volume mount

Recommended Posts

A story about speeding up unittest on Docker for Mac
A story about Java 11 support for Web services
Building a Ruby environment for classes on Mac
[Personal memo] A small story about CPUs settings of Docker Desktop for Windows
A story about starting a Java-related book club for newcomers
Install metrics-server with Helm on Kubernetes that comes with Docker for Mac
Prepare a transcendentally simple PHP & Apache environment on Mac with Docker
Create a Docker Image for redoc-cli and register it on Docker Hub
Steps to run docker on Mac
Try using Redmine on Mac docker
Run React on a Docker container
Docker on NILFS2 filesystem (for raspbianOS)
Use Docker on your M1 Mac
Run PureScript on a Docker container
Docker For Mac Slow: Countermeasure II
A story about a university student publishing a product on GitHub for self-appeal in the selection of laboratory assignments
Let's install Docker on Windows 10 and create a verification environment for CentOS 8!
How to build a Ruby on Rails environment using Docker (for Docker beginners)
Creating a java web application development environment with docker for mac part1
[Beginner] A story about starting studying Java for job hunting ~ 3rd month ~
[Beginner] A story about starting studying Java for job hunting ~ 1st month ~
[Beginner] A story about starting studying Java for job hunting ~ 5th month ~
Created a Docker container image for an OpenLDAP server based on Fedora
Create a java web application development environment with docker for mac part2
[Beginner] A story about starting studying Java for job hunting ~ 4th month ~
Customize OpenFOAM v8 Docker Image on Mac
Install Docker Desktop for Mac with Homebrew
[Ruby on Rails] About bundler (for beginners)
Getting Started with Docker for Mac (Installation)
Introducing Docker Desktop for Windows on WSL2
Build a Java development environment on Mac
Set up Docker Registry locally on CentOS 7
[Docker ECS] Detailed settings for docker compose up
Build a JMeter environment on your Mac
Run Ubuntu + ROS with Docker on Mac
Create a Docker container for your development web server in Ansible on MacOS
A story about a super beginner participating in the AtCoder contest for the first time (AtCoder Beginner Contest 140)