pyveci/racker

Optimize "time-to-shell" for Windows containers

Opened this issue · 1 comments

amotl commented

With #4, the Windows subsystem gets actually usable. However, it currently has three speed bumps when looking at optimizing the "time-to-shell" 1.

A. Container image inspection

Before launching the container, we need to inspect its image in order to select which WDM host to use (Windows 2016, 2019, or 2022). On certain container images, we observed this can take up to three seconds when using skopeo inspect.

$ time skopeo --override-os=windows inspect --config --no-tags docker://docker.io/eclipse-temurin:18-jdk > /dev/null

real	0m3.262s
user	0m0.026s
sys	0m0.212s

We need to mitigate that speed bump, for example by caching the output of the skopeo inspect call. It will not be too difficult.

B. Container image adjustments

Currently, docker build is invoked on every invocation. Getting rid if it will save another 0.5 seconds.

C. PowerShell slowness

We are asking the community about any guidance on this matter. Does PowerShell really have such a large invocation overhead when compared to the cmd shell?

With the cmd program, it takes around 1.4 to 2.6 seconds to spawn a shell.

time racker run --rm --platform=windows/amd64 mcr.microsoft.com/windows/servercore:{ltsc2016,ltsc2019,ltsc2022} -- cmd /C exit

The powershell program takes around 3.1 to 4.7 seconds to spawn a shell.

time racker run --rm --platform=windows/amd64 mcr.microsoft.com/windows/servercore:{ltsc2016,ltsc2019,ltsc2022} -- powershell -Command exit

Footnotes

  1. The time needed to launch a container and connect your terminal to a shell inside the container.

amotl commented

Caching inquiries to upstream OCI registries is also important for another reason.

$ racker --verbose run --rm --platform=windows/amd64 winamd64/python:3.10-windowsservercore-ltsc2022 -- python -V
2022-06-11 21:13:31,035 [racker.cli        ] INFO    : Preparing runtime environment for platform windows/amd64 and image winamd64/python:3.10-windowsservercore-ltsc2022
2022-06-11 21:14:04,374 [postroj.winrunner ] ERROR   : Inquiring information about OCI image 'docker://winamd64/python:3.10-windowsservercore-ltsc2022' failed. Command 'skopeo --override-os=windows inspect --config --no-tags docker://winamd64/python:3.10-windowsservercore-ltsc2022' returned non-zero exit status 1. Reason: time="2022-06-11T21:14:04+02:00" level=fatal msg="Error parsing image name \"docker://winamd64/python:3.10-windowsservercore-ltsc2022\": reading manifest 3.10-windowsservercore-ltsc2022 in docker.io/winamd64/python: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit"

Error parsing image name "docker://winamd64/python:3.10-windowsservercore-ltsc2022": reading manifest 3.10-windowsservercore-ltsc2022 in docker.io/winamd64/python: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit