RPS not getting obeyed

Hello K6 newbie here,
I am testing out a http request where I am using --vus 5 but i want to the --rps to be 15 for duration of 30s, After the test runs ,I am getting RPS of ~ 9RPS. My goal is to see that 15RPS is achieved (from this rate its implied ,that per user I want 3 RPS)

How can achieve this ? Please help
Command: k6 run ./eventTest/test.js --vus 5 --rps 15 --duration 30s
Code:

import http from ‘k6/http’;
import { sleep, check } from ‘k6’;
import { Counter } from ‘k6/metrics’;
export const requests = new Counter(‘http_reqs’);
export const options = {
thresholds: {
requests: [‘count < 100’],
},
};
export default function() {
const res = http.get(‘http://test.k6.io’);
const checkRes = check(res, {
‘status is 200’: r => r.status === 200,
‘response body’: r => r.body.indexOf(‘Feel free to browse’),
});
}

OUTPUT:

duration: 30s, iterations: -
vus: 5, max: 5

done [==========================================================] 30s / 30s0

✓ response body 
✓ status is 200 

checks.....................: 100.00% ✓ 534 ✗ 0
data_received..............: 2.9 MB  98 kB/s
data_sent..................: 20 kB   676 B/s
http_req_blocked...........: avg=6.07ms   min=0s       med=0s       max=416.67ms p(90)=0s       p(95)=0s
http_req_connecting........: avg=5.33ms   min=0s       med=0s       max=288.03ms p(90)=0s       p(95)=0s
http_req_duration..........: avg=525.02ms min=322.85ms med=391.64ms max=1.45s    p(90)=730.93ms p(95)=956.15ms
http_req_receiving.........: avg=137.68ms min=0s       med=21ms     max=1.12s    p(90)=336.18ms p(95)=411.3ms
http_req_sending...........: avg=11.16µs  min=0s       med=0s       max=999.6µs  p(90)=0s       p(95)=0s
http_req_tls_handshaking...: avg=0s       min=0s       med=0s       max=0s       p(90)=0s       p(95)=0s
http_req_waiting...........: avg=387.32ms min=299.85ms med=346.31ms max=1.14s    p(90)=634.07ms p(95)=681.81ms
http_reqs..................: 267     8.899596/s
iteration_duration.........: avg=553.12ms min=327.85ms med=442.87ms max=1.55s    p(90)=779.09ms p(95)=957.15ms
iterations.................: 267     8.899596/s
vus........................: 5       min=5 max=5
vus_max....................: 5       min=5 max=5

As stated in the documentation, the rps option restricts the maximum number of requests to make per second. So, in your case, you either have to increase the number of VUs, or increase the number of requests that each VU is making simultaneously, perhaps via http.batch()

Hi @rajeevnandi1,

Another way to generate a constant RPS is to go through the workaround we have portrayed here:
How to generate a constant request rate in k6?

Hope it helps you achieve your desired results.

Good luck!

Hi @rajeevnandi1,

I have written a new blog post explaining the constant-arrival-rate executor to generate a constant request rate via the new scenarios API:

How to generate a constant request rate in k6 with the new scenarios API?

Good luck! :slight_smile: