Nested resources are not working

Gatling version: 3.13.3
Gatling flavor: java
Gatling build tool: gradle

Hello folks,
I’m trying to simulate a web browser parallel fetching with following simulation:

    private ScenarioBuilder loadProductionRecordPage() {
        return scenario("Load Record Page | Start phase")
            .exec(ServiceApiCalls.getRecord()
                .resources(
                    ServiceApiCalls.getRecordChildren()
                        .resources(ServiceApiCalls.getNodeChildren(),
                            ServiceApiCalls.getNodeChildren()),
                    ServiceApiCalls.getRecordSummary())
            );
    }

Problem is that 2 requests from first resources block are executed normally, but requests from second (nested) resources block are not executed at all.
Is this expected behavior?
Off-topic question, is it planned to add session handling in resources block?

Expected behavior.
You cannot have resources on resources.
In your example, only ServiceApiCalls.getRecordChildren() and ServiceApiCalls.getRecordSummary() will be called.

Off-topic question, is it planned to add session handling in resources block?

Distinct question => distinct post please.

Ok, I think I have a workaround for this one. When I put second resources block after the first one it start work when all requests in first resources were executed.

    private ScenarioBuilder loadProductionRecordPage() {
        return scenario("Load Record Page | Start phase")
            .exec(ServiceApiCalls.getRecord()
                .resources(
                    ServiceApiCalls.getRecordChildren(),
                    ServiceApiCalls.getRecordSummary())
               .resources(ServiceApiCalls.getNodeChildren(),
                            ServiceApiCalls.getNodeChildren())
            );
    }

Exactly the same things as:

scenario("Load Record Page | Start phase")
            .exec(ServiceApiCalls.getRecord()
                .resources(
                    ServiceApiCalls.getRecordChildren(),
                    ServiceApiCalls.getRecordSummary(),
                    ServiceApiCalls.getNodeChildren(),
                    ServiceApiCalls.getNodeChildren()
              )
            );

hmm, is it?
I was expecting that ServiceApiCalls.getRecordChildren() and ServiceApiCalls.getRecordSummary() will be executed in parallel, and only after they finish ServiceApiCalls.getNodeChildren() requests will be executed in parallel.
In your example, all 4 requests should be executed in parallel without waiting for anything else…
Am I wrong?

Yes, you’re wrong.
Calling resources multiple times merely appends to the existing list.

1 Like

Over HTTP/1.1, concurrency is capped by the maximum amount of connections per remote host.
Over HTTP/2, concurrency is uncapped as requests are streams over the same HTTP connection.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.