본문 바로가기
카테고리 없음

[k6][Loadtest] How to use multiple executors

by guru_k 2022. 4. 14.
728x90
반응형

K6 provides executors

 

Executors

Executors are the workhorses of the k6 execution engine. Each one schedules VUs and iterations differently, and you choose one depending on the type of traffic you want to model to test your services

k6.io

How to use multiple executors to scenarios

make a test script.js

import http from 'k6/http';
import { sleep } from 'k6';

export let options = {
    scenarios: {
        foo: {
            executor: 'constant-vus',
            vus: 100,
            duration: '10m',
            exec: 'firstScenario'
        },
        bar: {
            executor: 'constant-arrival-rate',
            rate: 10,
            timeUnit: '1s',
            duration: '10m',
            preAllocatedVUs: 25,
            exec: 'secondScenario'
        },
    },
};

export function firstScenario() { 
	http.get('https://test.k6.io');
	sleep(1);
}
export function secondScenario() {
	http.get('https://test.k6.io');
	sleep(1);
}

Run test script

$ k6 run script.js

running (01m32.5s), 1025/1025 VUs, 323 complete and 0 interrupted iterations
firstScenario      [--------------------------------------] 1/25 VUs  01m32.5s/10m0s  10 iters/s
secondScenario     [--------------------------------------] 1000 VUs  01m32.5s/10m0s

 

728x90
반응형

댓글