TPS distribution - help needed

Hi @mostafa - I have gone through the documentation of TPS distribution. still facing some issues.
Can you please help me here.

I have below 2 groups. How can i distribute the TPS between these 2 groups. Can you please give me a logic here.

group(‘00_test1’, body2), sleep(thinkTime) - 10TPS
group(‘01_test2’, body2), sleep(thinkTime) - 2 TPS

Instead of using group() for this, I’d suggest using 2 different constant-arrival-rate scenarios. Please take a look at https://k6.io/docs/using-k6/scenarios, https://k6.io/docs/using-k6/scenarios/executors/constant-arrival-rate and at @mostafa’s blog article on the topic: https://k6.io/blog/how-to-generate-a-constant-request-rate-with-the-new-scenarios-api

Thanks @ned - Does it has any issue with not logging the response body, after implementing scenario logic? Without the scenario logic - I can get and print the response body of a particular post call. But after applying scenarios, I am able to get 200/201 status code, but the body is coming as null. Its not issue with the call. It does work without the scenario logic. but in this case
INFO[0003] 08_Call status code is :: 201
INFO[0003] 08_Call Body is :: null.

In addition, in our application logs - it does shows all the call which are getting hit.

logic
let res = http.post(“http://test.io”, JSON.stringify(body), { headers: headers });
Console.log('08_Call - status code is :: ’ + res.status)
Console.log('08_Call Body is :: ’ + res.body)

Yeah I just verified with your example given as well.
http.get(‘http://test.k6.io/contacts.php’);

It also doesn’t print the response body.
Can you tell me how we can see the output response body and capture something as correlation.

All the calls response body is null…

Do we have any specific command to check on the response body and then capture after applying scenario logic ?

I think i have figured out - discardResponseBodies: false. It’s working as expected. But the same is not working with docker-compose.

why scenarios not working with docker-compose setup… any idea ?

This works without docker-compose, but when i use docker-compose it doesn’t work…it just run for 1 iteration can you help if any specific setup needs to be done for docker-compose? @ned @mostafa

Hi @pawansinha4u,
Scenarios are from v0.27.0 onward so I would guess that you are just using an old docker image.

And - yes discardResponseBodies will make it so all bodies are null … as they won’t be saved, but discarded :wink: . You can use responseType (you will need to search in the page) to get the body for a specific request, or to discard it for a specific one if discardResponseBodies is false.

1 Like

@mstoykov - yeah silly mistake… docker image was old… Thanks

@mstoykov - Please help in TPS ditribution
I am using the below code

export let options = {
    discardResponseBodies: false,
    scenarios: {
        contacts: {
            executor: 'constant-arrival-rate',
            rate: 1, 
            duration: '1m',
            preAllocatedVUs: 1,
            maxVUs: 1,
            timeUnit: '1m'
        },
        contacts1: {
            executor: 'constant-arrival-rate',
            rate: 2, 
            duration: '1m',
            preAllocatedVUs: 2,
            maxVUs: 2,
            timeUnit: '1m'
        }
    },
};

export function contacts() {
    siolamain()
}

export function contacts1() {
    sbolamain()
    sbolaTradermain()
    sbolaETB()
}


export default function () {

    contacts() // This Should run 1 iteration with 1 user
    contacts1() // This Should run 2 iteration with 2 user - Total 4 iteration
  

}  

OUTPUT
not expected

@mstoykov I tried this Scenario as well - But the outcome is all the transactions within contacts() and contacts1() went for 6 iteration.

export let options = {
    discardResponseBodies: false,
    scenarios: {
        contacts: {
            executor: 'shared-iterations',
            vus: 1,
            iterations: 2,
            maxDuration: '2m',
        },
        contacts1: {
            executor: 'shared-iterations',
            vus: 2,
            iterations: 4,
            maxDuration: '4m',
        }
    },
};

export function contacts() {
    siolamain()
}

export function contacts1() {
    sbolamain()
    sbolaTradermain()
    sbolaETB()
}


export default function () {

    contacts()
    contacts1()
 

}

You are not setting exec, @pawansinha4u, so it just defaults to default and runs the default function.

It is not the name of the scenario that is used to decide which function to be run, it is what is configured with exec :wink: