共用方式為


Performance tuning for ACR (Azure Container Registry)

My customer wants to optimize the ACR (Azure Container Registry) docker pull performance.
I've done some performance experiment for ACR.

Experiment

acrperformance
I upload a big docker image(1.98G) then pull it and track the time. I live in Japan. I used to use West US region for ACR. However, now we can use Japan East region. Let's experiment it. Source = the region for an ACR.

Case 1: Local PC

Using my local PC (Windows 10, Surface Pro 4 with Docker for Windows), pull the image and track time.
We can see the big differences between West US and Japan East throughput.

I want to try it using Azure VM.

 docker login xxxxxxjapan.azure.io
powershell -C Measure-Command {docker push xxxxxxjapan.azurecr.io/sample}
docker rmi xxxxxxx
powershell -C Measure-Command {docker push xxxxxxwestus.azurecr.io/sample}

Case 2: Azure Linux (DS1_V2)

I choose a small instance for it. Compared with Local PC, the performance improvement is totally good.
When I observe the execution, I noticed when we use Azure VM, download finished very quickly, then extracting
the image looks taking a lot of time.

Let's try to scale up then test it.

 docker login xxxxxxjapan.azure.io
time docker push xxxxxxjapan.azurecr.io/sample
docker rmi xxxxxxx
time docker push xxxxxxwestus.azurecr.io/sample

Case 3: Azure Linux (DS13_V2)

As I expected, the performance improvement is massive. DS13_V2 have a lot of CPU's, Mem, High IOPS, and High Network performances than DS1_V2. I don't know which aspect effects this time. I'd like to experiment more.

Azure Instance Size in Japan

Case 4: Azure Linux (DS13_V2 + /dev/sdb)

Then I try to improve more. I decided to use the temporary disk. We can change the configuration for docker images.
However, these are not a big difference between Case 4 and 3. This time, the temporary disk doesn't effect a lot.
If you want to switch the docker image disk,  you can do like this.

 

 sudo vi /lib/systemd/system/docker.service

You need to change this line

 ExecStart=/usr/bin/dockerd -H fd:// -g "/mnt/docker"

Then restart docker.

 
sudo systemctl daemon-reload
sudo systemctl restart docker


Additional Tips

When I searched on the internet, and talk to my colleague, I've never tried but read some advice. I'd like to share some.

Docker image size

The image size (1.98GB) is too big. You can change the base image. Then you can make it smaller.
e.g.  https://hub.docker.com/_/alpine/

Network interface

Only for Mac. If you use Virtual Box, you can change the network interface. It will improve a lot.

https://github.com/docker/kitematic/issues/577

Cache

You can use a proxy for a cache. However, you need to reconfigure your docker client for it.

https://stackoverflow.com/questions/36372755/how-to-optimise-docker-pull-speed


Conclusion

If you want to improve ACR performance, you can do ...

1. Use the same region between ACR and a client which you pull docker image
2. Use VM(or PaaS) on Azure as a client which you pulls a docker image
3. Consider a client spec for extracting docker image (CPU, Mem, IOPS, Network)

Also...

4. Making an image small.

If you have any other tips, please share via a comment.