server: bench: select prompts based on the current iteration id not randomly to make the bench more reproducible

This commit is contained in:
Pierrick HYMBERT 2024-03-09 22:54:24 +01:00
parent 52c76d57a5
commit 6bfb80eb75

View file

@ -2,6 +2,7 @@ import http from 'k6/http'
import {check, sleep} from 'k6' import {check, sleep} from 'k6'
import {SharedArray} from 'k6/data' import {SharedArray} from 'k6/data'
import {Counter, Rate, Trend} from 'k6/metrics' import {Counter, Rate, Trend} from 'k6/metrics'
import exec from 'k6/execution';
// Server chat completions prefix // Server chat completions prefix
const server_url = __ENV.SERVER_BENCH_URL ? __ENV.SERVER_BENCH_URL : 'http://localhost:8080/v1' 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 () { export default function () {
const conversation = data[Math.floor(Math.random() * data.length)] const conversation = data[exec.scenario.iterationInInstance % data.length]
const payload = { const payload = {
"messages": [ "messages": [
{ {