From 40e0ffbda8396c088413e0f769525faf9450553a Mon Sep 17 00:00:00 2001 From: Hassy Veldstra Date: Thu, 17 Oct 2024 12:02:19 +0100 Subject: [PATCH] feat: stagger startup of containers on Azure (#3371) --- packages/artillery/lib/platform/az/aci.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/artillery/lib/platform/az/aci.js b/packages/artillery/lib/platform/az/aci.js index 37a9b4efe4..e9771b0cac 100644 --- a/packages/artillery/lib/platform/az/aci.js +++ b/packages/artillery/lib/platform/az/aci.js @@ -320,6 +320,15 @@ class PlatformAzureACI { const { workerId } = await this.createWorker(); this.workers[workerId] = { workerId }; await this.runWorker(workerId); + + if (i > 0 && i % 10 === 0) { + const delayMs = + Math.floor( + Math.random() * + parseInt(process.env.AZURE_LAUNCH_STAGGER_SEC || '10', 10) + ) * 1000; + await sleep(delayMs); + } } let instancesCreated = false;