efficiency – Tips on how to configure JMeter to dynamically learn knowledge from considered one of a number of CSV recordsdata based mostly on load distribution?

0
2
efficiency – Tips on how to configure JMeter to dynamically learn knowledge from considered one of a number of CSV recordsdata based mostly on load distribution?


I am engaged on efficiency testing a multi-tenant software utilizing Apache JMeter. I need to simulate load coming from three completely different shoppers, the place every consumer’s knowledge is saved in a separate CSV file. The load ought to be distributed like this:

  • Consumer 1: 60%
  • Consumer 2: 30%
  • Consumer 3: 10%

All CSV recordsdata have the identical construction (columns), however include completely different knowledge per consumer.

My Objective:
I need every thread to randomly and proportionally decide knowledge from the suitable CSV file based mostly on the chances above and use it within the HTTP requests with out knowledge overlap or inconsistency.

What I Tried:

Strategy 1: Dynamically set file path utilizing a variable
My Jmeter Check Plan construction is,

Check Plan
|-- Consumer Outlined Variables
|-- CSV Information Set Config
|-- Stepping Thread Group
|-- |-- JSR223 PreProcessor
|-- |-- HTTP Request Sampler 1
|-- |-- HTTP Request Sampler 2
|-- |-- HTTP Request Sampler n
|-- View Outcome Tree
|-- Abstract Report

Within the Check Plan, I’ve a variable path outlined in Consumer Outlined Variables as:

path = D:/jmeter/undertaking

I then set the Filename in CSV Information Set Config to ${csvFile}.

Inside a JSR223 PreProcessor, I attempted setting the csvFile variable like this:

def randomValue = Math.random()
if (randomValue < 0.6) {
    vars.put('csvFile', "${path}/file1.csv")
} else if (randomValue < 0.9) {
    vars.put('csvFile', "${path}/file2.csv")
} else {
    vars.put('csvFile', "${path}/file3.csv")
}

The problem is, though csvFile will get set accurately within the JSR223 PreProcessor, the CSV Information Set Config does not decide up the worth dynamically.

Strategy 2: Dynamically set file path utilizing a variable and place the CSV Information Set Config after the JSR223 PreProcessor

My Jmeter Check Plan construction is,

Check Plan
|-- Consumer Outlined Variables
|-- Stepping Thread Group
|-- |-- JSR223 PreProcessor
|-- |-- CSV Information Set Config
|-- |-- HTTP Request Sampler 1
|-- |-- HTTP Request Sampler 2
|-- |-- HTTP Request Sampler n
|-- View Outcome Tree
|-- Abstract Report

Nonetheless the outcome is identical as in Strategy 1.

I believe it is as a result of execution order, as JMeter processes the CSV Information Set Config earlier than the PreProcessor runs.

My Query:

What’s the appropriate method in JMeter to:

  • Dynamically and proportionally distribute threads throughout a number of CSV recordsdata
  • Guarantee clear separation of information per thread (no variable conflicts)
  • Keep away from knowledge overlap or race circumstances between threads

Observe: I can’t share precise screenshots or undertaking recordsdata resulting from employer restrictions, however I am searching for a JMeter-safe and scalable method to simulate this type of weighted load throughout shoppers utilizing separate CSV recordsdata or something different suggestion for tackling this challenge.

Any concepts or suggestions for managing this successfully?

LEAVE A REPLY

Please enter your comment!
Please enter your name here