Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      CodeSOD: A Unique Way to Primary Key

      July 22, 2025

      BrowserStack launches Figma plugin for detecting accessibility issues in design phase

      July 22, 2025

      Parasoft brings agentic AI to service virtualization in latest release

      July 22, 2025

      Node.js vs. Python for Backend: 7 Reasons C-Level Leaders Choose Node.js Talent

      July 21, 2025

      The best CRM software with email marketing in 2025: Expert tested and reviewed

      July 22, 2025

      This multi-port car charger can power 4 gadgets at once – and it’s surprisingly cheap

      July 22, 2025

      I’m a wearables editor and here are the 7 Pixel Watch 4 rumors I’m most curious about

      July 22, 2025

      8 ways I quickly leveled up my Linux skills – and you can too

      July 22, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      The Intersection of Agile and Accessibility – A Series on Designing for Everyone

      July 22, 2025
      Recent

      The Intersection of Agile and Accessibility – A Series on Designing for Everyone

      July 22, 2025

      Zero Trust & Cybersecurity Mesh: Your Org’s Survival Guide

      July 22, 2025

      Execute Ping Commands and Get Back Structured Data in PHP

      July 22, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      A Tomb Raider composer has been jailed — His legacy overshadowed by $75k+ in loan fraud

      July 22, 2025
      Recent

      A Tomb Raider composer has been jailed — His legacy overshadowed by $75k+ in loan fraud

      July 22, 2025

      “I don’t think I changed his mind” — NVIDIA CEO comments on H20 AI GPU sales resuming in China following a meeting with President Trump

      July 22, 2025

      Galaxy Z Fold 7 review: Six years later — Samsung finally cracks the foldable code

      July 22, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»How to configure JMeter to dynamically read data from one of multiple CSV files based on load distribution?

    How to configure JMeter to dynamically read data from one of multiple CSV files based on load distribution?

    April 21, 2025

    I’m working on performance testing a multi-tenant application using Apache JMeter. I want to simulate load coming from three different clients, where each client’s data is stored in a separate CSV file. The load should be distributed like this:

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

    All CSV files have the same structure (columns), but contain different data per client.

    My Goal:
    I want each thread to randomly and proportionally pick data from the appropriate CSV file based on the percentages above and use it in the HTTP requests without data overlap or inconsistency.

    What I Tried:

    Approach 1: Dynamically set file path using a variable
    My Jmeter Test Plan structure is,

    Test Plan
    |-- User Defined Variables
    |-- CSV Data Set Config
    |-- Stepping Thread Group
    |-- |-- JSR223 PreProcessor
    |-- |-- HTTP Request Sampler 1
    |-- |-- HTTP Request Sampler 2
    |-- |-- HTTP Request Sampler n
    |-- View Result Tree
    |-- Summary Report
    

    In the Test Plan, I have a variable path defined in User Defined Variables as:

    path = D:/jmeter/project
    

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

    Inside a JSR223 PreProcessor, I tried 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 issue is, even though csvFile gets set correctly in the JSR223 PreProcessor, the CSV Data Set Config doesn’t pick up the value dynamically.

    Approach 2: Dynamically set file path using a variable and place the CSV Data Set Config after the JSR223 PreProcessor

    My Jmeter Test Plan structure is,

    Test Plan
    |-- User Defined Variables
    |-- Stepping Thread Group
    |-- |-- JSR223 PreProcessor
    |-- |-- CSV Data Set Config
    |-- |-- HTTP Request Sampler 1
    |-- |-- HTTP Request Sampler 2
    |-- |-- HTTP Request Sampler n
    |-- View Result Tree
    |-- Summary Report
    

    Still the result is the same as in Approach 1.

    I suspect it’s due to the execution order, as JMeter processes the CSV Data Set Config before the PreProcessor runs.

    My Question:

    What is the correct way in JMeter to:

    • Dynamically and proportionally distribute threads across multiple CSV files
    • Ensure clean separation of data per thread (no variable conflicts)
    • Avoid data overlap or race conditions between threads

    Note: I cannot share actual screenshots or project files due to employer restrictions, but I’m looking for a JMeter-safe and scalable way to simulate this kind of weighted load across clients using separate CSV files or anything other suggestion for tackling this issue.

    Any ideas or recommendations for managing this effectively?

    Source: Read More

    Facebook Twitter Reddit Email Copy Link
    Previous ArticleThe Ultimate Guide to Demo Websites for Selenium Automation Testing
    Next Article ByteDance Releases UI-TARS-1.5: An Open-Source Multimodal AI Agent Built upon a Powerful Vision-Language Model

    Related Posts

    Development

    GPT-5 is Coming: Revolutionizing Software Testing

    July 22, 2025
    Development

    Win the Accessibility Game: Combining AI with Human Judgment

    July 22, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    Running Multiple Test Cases from a CSV File Using Playwright and TypeScript.

    Development

    chess22k is a chess engine written in Java

    Linux

    Simplifying UAE VAT and E-Invoicing Challenges with ERP Solutions

    Web Development

    How effective is CBT for social anxiety?

    Web Development

    Highlights

    Cisco’s Latest AI Agents Report Details the Transformative Impact of Agentic AI on Customer Experience

    May 31, 2025

    The customer experience (CX) paradigm within B2B technology is undergoing a substantive evolution, propelled by…

    This AI Paper from Anthropic Introduces Attribution Graphs: A New Interpretability Method to Trace Internal Reasoning in Claude 3.5 Haiku

    April 6, 2025

    CVE-2025-5873 – eCharge Hardy Barth Salia Web UI Unrestricted File Upload Vulnerability

    June 9, 2025
    Is the Minecraft Chicken Jockey meme finally dead? Jimmy Fallon may have just saved us

    Is the Minecraft Chicken Jockey meme finally dead? Jimmy Fallon may have just saved us

    April 10, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.