trying to run k6 performance test cases by using the following scenario's
how to hit x amount of API per min for example: Produce 500 messages per minute → Check how API behaves
It should be same, next time we run the test case.
trying to run k6 performance test cases by using the following scenario's
how to hit x amount of API per min for example: Produce 500 messages per minute → Check how API behaves
It should be same, next time we run the test case.
This is easily achievable with the constant-arrival-rate executor:
import http from 'k6/http';
import { sleep } from 'k6';
export const options = {
scenarios: {
500_mps: {
executor: 'constant-arrival-rate',
duration: '10m',
rate: 500,
timeUnit: '1m',
preAllocatedVUs: 10,
maxVUs: 100,
},
},
};
export default function() {
http.get('your api');
}
The above code will try to run the default function 500 times per minute for 10 minutes. It will use at most 100 VUs – if your API is too slow, k6 will not start more VUs and you will not reach the target load.