From 08378259be2039f5ffd21b46b7a74b8addfe99c5 Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Tue, 21 May 2024 17:12:17 +0100 Subject: [PATCH] detailed perf logging for checkpointing --- apps/coordinator/src/index.ts | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/apps/coordinator/src/index.ts b/apps/coordinator/src/index.ts index a1dbfcc11..611b1ee04 100644 --- a/apps/coordinator/src/index.ts +++ b/apps/coordinator/src/index.ts @@ -308,21 +308,45 @@ class Checkpointer { throw new Error("could not find container id"); } + const start = performance.now(); + + // Create checkpoint this.#logger.debug(await $$`crictl checkpoint --export=${exportLocation} ${containerId}`); + const postCheckpoint = performance.now(); // Create image from checkpoint const container = this.#logger.debug(await $$`buildah from scratch`); + const postFrom = performance.now(); + this.#logger.debug(await $$`buildah add ${container} ${exportLocation} /`); + const postAdd = performance.now(); + this.#logger.debug( await $$`buildah config --annotation=io.kubernetes.cri-o.annotations.checkpoint.name=counter ${container}` ); + const postConfig = performance.now(); + this.#logger.debug(await $$`buildah commit ${container} ${imageRef}`); + const postCommit = performance.now(); + this.#logger.debug(await $$`buildah rm ${container}`); + const postRm = performance.now(); // Push checkpoint image this.#logger.debug(await $$`buildah push --tls-verify=${REGISTRY_TLS_VERIFY} ${imageRef}`); + const postPush = performance.now(); - this.#logger.log("Checkpointed and pushed image to:", { location: imageRef }); + const perf = { + "crictl checkpoint": postCheckpoint - start, + "buildah from": postFrom - postCheckpoint, + "buildah add": postAdd - postFrom, + "buildah config": postConfig - postAdd, + "buildah commit": postCommit - postConfig, + "buildah rm": postRm - postCommit, + "buildah push": postPush - postRm, + }; + + this.#logger.log("Checkpointed and pushed image to:", { location: imageRef, perf }); try { await $$`rm ${exportLocation}`;