Skip to content

Instantly share code, notes, and snippets.

@bdelacretaz
Created May 10, 2019 10:03
Show Gist options
  • Save bdelacretaz/eb24e4a28ccfbe853812ad9983dec4cf to your computer and use it in GitHub Desktop.
Save bdelacretaz/eb24e4a28ccfbe853812ad9983dec4cf to your computer and use it in GitHub Desktop.

Measuring Docker image time to first request

This is a just rough method with rough results...

cat ctest.bash 
URL=http://localhost:8080
while true
do
  curl $URL 2>/dev/null || continue
  echo
  echo "Success from $URL at $(gdate +%T.%N)"
  break
done

$ ./ctest.bash 

$ gdate +%T.%N ; docker run -p 8080:8080 some-docker-image
11:59:43.615812000
2019-05-10 09:59:44,252 INFO  [io.quarkus] (main) Quarkus 0.12.0 started in 0.004s. Listening on: http://0.0.0.0:8080
2019-05-10 09:59:44,252 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy]

# ...and the ctest script then says
hello
Success from http://localhost:8080 at 11:59:44.950311000
$ 

At this point we can rouhgly compute

11:59:44.950311000 - 11:59:43.615812000 

For a total startup time of about 1.3 seconds.

It's rough...looping curl in this way takes some time, but running the test several times should give a ballpark figure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment