title: Session/cookie management in Apache JMeter
body: <p>We have a simple performance test flow in an application.</p>
  
  <ol>
  <li>We login</li>
  <li>Search based on some criteria</li>
  <li>repeat searches for different parameters. </li>
  </ol>
  
  <p>We are using Jmeter to do a performance testing. We need to have multiple threads running to test this in a scalable manner.</p>
  
  <p>The way we currently have this arranged is:</p>
  
  <pre><code>-Test Plan
    - Thread Group
        - Cookie Manager
        - Login To application
        - Search on param 1
        - Search on param 2
    - results summary table
    - Summary report
  </code></pre>
  
  <p>So basically we have summary return table and report present on plan level while cookie manager is present on thread group level. </p>
  
  <p>When I run for one thread it runs fine and completes well. When I scale it to multiple threads, as soon as the next thread kicks off, the session for the last thread is invalidated. This causes failures for all the already running threads due to newly spawned thread.</p>
  
  <p>I reached this result with observation:
  <br>1. If I run multiple threads, only last thread has got valid responses in result summary tree
  <br>2. If I run with 2 threads with ramp up period as 10 seconds, which means each thread gets time to finish itself, then both of them run successfully. </p>
  
  <p>As per my understanding each thread login's into application and since cookie manager is at thread level, the values will be maintained for session id for each thread respectively? But what is causing the override of the session id value between threads?</p>
  
  <p>Any help will be much appreciated. </p>