Multiple k6 instances

Hi,

I have a scenario that I want to run different k6 scripts at the same time. ( I will be using the drone CI/CD pipeline to execute the scripts)

Following is how the test scripts getting execute

  • k6 run page1.js
  • k6 run page2.js
  • k6 run page3.js
  • k6 run page4.js

when this is getting executed I can see the following error
time=“2023-04-20T21:02:17Z” level=warning msg=“Error from API server” error=“listen tcp 127.0.0.1:6565: bind: address already in use”

I found the flag “–address=” and applied to each of my script, which solves the issue

But I would like to understand what is the impact of 'address already in use" warning on my test? and what is the recommend approach when working with multiple k6 scripts together.

Thanks

Hi @sashi1

But I would like to understand what is the impact of 'address already in use" warning on my test?

The warning means that all of the instances besides the first won’t be controllable by their REST API or by commands like k6 pause , k6 resume , k6 stats , etc.

and what is the recommend approach when working with multiple k6 scripts together.

If you don’t care about the REST API, you can also start k6 with --address="" , we would recommend disabling the REST API without having to provide a unique address for each k6 run. Also note that you can use multiple scenarios at the same time, following Test suites / execute multiple scripts with k6 · Issue #1342 · grafana/k6 · GitHub if multiple scenarios are not sufficient for you use case.

I hope this helps.

Cheers!

Hi,

Thank you for your response. How can I disable the REST API?

Hi @sashi1

Setting --address="" disables the REST API. Apologies if my initial message was not clear :bowing_woman:

Cheers!

1 Like