How to config load distribution between different calls for different tests

In my test, I need to run 3 different HTTP calls in parallel. Each call will have different stages with different throughput rates. Stages and rates will be different depending on what type of test I am running (stress, spike, soak etc). Generally, I need to achieve:

Call1 = 90% iterations
Call2 = 15% iterations
Call3 = 5% iterations

My current solution is to have a different JS Script for each Call. Each script has its own config file with different scenarios in it.

{
  "scenarios": {
    "soakTest": {
      "executor": "ramping-arrival-rate",
      ...
    },
    "spikeTest": {
      "executor": "ramping-arrival-rate",
      ...
    },"stressTest": {
      "executor": "ramping-arrival-rate",
      ...
    }
  }
}

I am planning to run it in parallel treads as below

k6 run --config call-1-config.json  call-1-test.js &
k6 run --config call-2-config.json  call-2-test.js &
k6 run --config call-3-config.json  call-3-test.js &

However, each “k6 run …” command runs all 3 scenarios in parallel.

soakTest ✗ [=>-----------------------------------
spikeTest ✗ [==>----------------------------------
stressTest ✗ [==>----------------------------------

Is it a way to run a single scenario from a config file? Maybe I can use env variables or when I run it in CLI?
Or is there an alternative way to config it, so it will not be too many scripts and config files?

Hi @Jac !

Welcome to the community forums! :wave:

Before moving to answer questions. Did I get you right that you want to run simultanesly soak, spike & stress tests? :thinking:

Cheers

Hi @olegbespalov.
I want to run the tests separately, but I want to run a few calls simultaneously in each test.
Basically I already found the solution. I organised the code and configuration completely differently now. My scenarios in config now are representing the call and not the test.

{
  "scenarios": {
    "call1": {
      "executor": "ramping-arrival-rate",
      "exec": "call1function",
      ...
    },
    "call2": {
      "executor": "ramping-arrival-rate",
      "exec": "call2function",
      ...
    },"call3": {
      "executor": "ramping-arrival-rate",
      "exec": "call3function",
      ...
    }
  }
}

And I have separate config file for each test:
spike-config.json
stress-config.json
soak-config.json

1 Like