From 6bfb80eb7576ea201886b3152f1b16e64c37eab5 Mon Sep 17 00:00:00 2001 From: Pierrick HYMBERT Date: Sat, 9 Mar 2024 22:54:24 +0100 Subject: [PATCH] server: bench: select prompts based on the current iteration id not randomly to make the bench more reproducible --- examples/server/bench/script.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/server/bench/script.js b/examples/server/bench/script.js index 49ed9db8e..a4f5ac5ab 100644 --- a/examples/server/bench/script.js +++ b/examples/server/bench/script.js @@ -2,6 +2,7 @@ import http from 'k6/http' import {check, sleep} from 'k6' import {SharedArray} from 'k6/data' import {Counter, Rate, Trend} from 'k6/metrics' +import exec from 'k6/execution'; // Server chat completions prefix const server_url = __ENV.SERVER_BENCH_URL ? __ENV.SERVER_BENCH_URL : 'http://localhost:8080/v1' @@ -72,7 +73,7 @@ export const options = { } export default function () { - const conversation = data[Math.floor(Math.random() * data.length)] + const conversation = data[exec.scenario.iterationInInstance % data.length] const payload = { "messages": [ {