mostafa/xk6-kafka

is there a way to control the messages per second generation?

Closed this issue · 2 comments

Hi, awesome tool!

Im wondering if there is a way to control the messages per second. is that possible?

Hey @converge,

Short answer:
It depends.

Long answer:
Since k6 is not controlling the creation and publishing of Kafka messages, you won't be able to match the same traffic patterns that k6 utilizes via scenarios, stages and other means. However, they do affect the way Kafka messages are created and published, as in, the number of VUs and iterations correlate with the number of messages produced. I initially used a for-loop to generate fake messages in example scripts and it stuck. So, you do not necessarily have to use a for-loop to generate your messages, as each iterations (of the default exported function from your script) calls the reader.produce once, hence more iterations equals more messages, unless you want to generate more messages in a single call to reader.produce. Also, I used --vus and --duration when running k6 tests, which translates to shared-iterations executor being used by k6, as I explained in this #244 (comment).

I recommend that you develop and run your script locally against a test instance and (roughly) measure how many requests your can produce to Kafka and then use that metric to control the message per second.

Hey,

I suppose your question is answered, I'll close this issue. If you have further questions related to the same issue, please re-open this, otherwise open a new one.