title: Parallel execution of Samplers in JMeter with different URL parameters
body: <p>There is "ForEach" controller in JMeter which takes an array of items and executes a sampler with each item. This is very useful when you need to execute a sampler with different  parameters based on data received in previous request. However, "ForEach" controller runs samplers one after the other. </p>
  
  <p>What I am looking for is, execute the samples in parallel. There is a plug in available in JMeter called, "bzm - Parallel Controller". However, this doesn't accept any input variable like "ForEach" controller does. </p>
  
  <p>For example, I have following data in database. Author along with their books.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>[
       {
        "firstName": "William",
        "lastName":"Shakespeare",
        "Title": "Mr",
        "id": "1",
        "books": [
         {
          "id": "WS1",
          "title": "King John",
          "year":"1596"
         },
         {
          "id": "WS2",
          "title": "Julius Caesar",
          "year": "1599"
         },
         {
          "id": "WS3",
          "title": "Romeo and Juliet",
          "year": "1595"
         }
        ],
        "Nationality": "English"
       },
       {
        "firstName": "Sidney",
        "lastName":"Sheldon",
        "Title": "Mr",
        "id": "2",
        "books": [
         {
          "id": "SS1",
          "title": "The Naked Face",
          "year":"1969"
         },
         {
          "id": "SS2",
          "title": "A Stranger in the Mirror",
          "year": "1976"
         },
         {
          "id": "SS3",
          "title": "Bloodline",
          "year": "1977"
         }
        ],
        "Nationality": "American"
       },
       {
        
        "firstName": "Eiichiro",
        "lastName":"Oda",
        "Title": "Mr",
        "id": "3",
        "books": [
         {
          "id": "EO1",
          "title": "Wanted",
          "year":"1992"
         },
         {
          "id": "EO2",
          "title": "Ikki Yako",
          "year": "1993"
         },
         {
          "id": "EO3",
          "title": "Monsters",
          "year": "1994"
         }
      
        ],
        "Nationality": "Japanese"
       }
      ]</code></pre>
  </div>
  </div>
  </p>
  
  <p>In my JMeter Test plan, I have defined a CSV Data Set Config file to store the ids of all authors in my system. 
  And then, there is a Thread Group. Inside thread group, I have a HTTP Sampler, GET /authors/{id}/books. for Example GET /authors/1/books. This will get all the books written by author "William Shakespeare".</p>
  
  <p>Using JSON Extractor, I can capture the array of book ids returned by GET /authors/{id}/books. </p>
  
  <p>There are 3 books with ids WS1, WS2 and WS3. Now for each of the books, I need to run another HTTP Sampler</p>
  
  <p>PUT /books/WS1
  PUT /books/WS2
  PUT /books/WS3. </p>
  
  <p>When I use ForEach controller, I can specify the input variable which was captured from previous JSON extractor. And it loops through each PUT request, for each book id. I want to do the same, but in PARALLEL, not sequential. </p>
  
  <p>Does anyone know how to achieve this? or we have to write custom groovy/BeanShell script for this? If custom Groovy/BeanShell script is the only way, can you please tell me how to write this</p>
  
  <p>Many thanks</p>