---
title: Multiple User Login Using JMeter
url: https://blog.octoperf.com/multiple-user-login-using-jmeter/
date: '2017-12-14'
authors:
- jloisel
categories:
- JMeter
tags:
- Design
- Variable
- CSV
description: You need to create a different thread with unique session for each user? Learn how to use different logins per user with a CSV file.
---

# Multiple User Login Using JMeter

## Problem

You want to simulate a realistic load test where every user is having a unique user session. You application may only accept one user login per account at a time. You want each concurrent user to pick a different login password.

It's way more realistic to simulate concurrent users using unique logins and passwords because it's closer to the real world load. **It's a good practice to avoid using a single user login and password for all concurrent users**. Typically, web servers create web sessions per account. Using a single account for multiple users can mess up things on server side pretty quickly.

## Solution

JMeter provides a facility to manage login and password: [CSV Dataset Config](https://jmeter.apache.org/usermanual/component_reference.html#CSV_Data_Set_Config). By defining a CSV file containing all the login and password couples, JMeter can pick a line from the file on each user iteration and assign them into variables. 


This is fairly straightforward, I'm going to explain how:

- First, create a csv file containing a couple of logins and passwords. Example: CSVSample_user.csv.

```csv
jsmith,passw0rd
jdoe,secret
```

- Then, in JMeter create a **CSV Dataset Config** under the *Thread Group*,
- Configure CSV Dataset in **All Threads** sharing mode to ensure each thread is picking a new csv line,
- Finally, create an HTTP Sampler and **${USERNAME}** as username, and **${PASSWORD}** as password.

The screenshot below shows the example configuration in JMeter.

![JMeter CSV Dataset Config](https://blog.octoperf.com/img/blog/multiple-user-login-using-jmeter/jmeter-csv-config.png)

Remember to copy the CSV file to each load generator before running a distributed test. Also, make sure the file is located at the same place on each load generator.
