Jmeter load testing for login - performance

I want to test how many users can concurrently login to the application. For that, can I create one user name and password and increase the thread to 100? or should I create 100 username and passwords and load it somehow?

Treat each JMeter thread (virtual user) as the real user using a real browser, it means:
Different credentials (can be provided via CSV Data Set Config)
Properly simulating browser network footprint including (but not limited to)
Sending and receiving headers (and cookies as special header sub-type)
Downloading embedded resources (images, scripts, styles, fonts, sounds)
Representing browser cache
Simulating AJAX requests
Mimicking real user "think time" as real users don't hammer application non-stop, they need some time to "think" between operations so consider adding appropriate Timers
Login itself won't tell you full story, you need to produce realistic workload, i.e. after logging in user should start doing something which he's normally doing

Usually concurrent users = different users, because it should be based on real case scenario
During a load test you try to emulate real-world conditions
If you want to have concurrent users in your application you should use different users because most servers won't allow same user to use your application with multiple sessions, also your application wants to (test) support multiple users so you need to load test the common scenario first.
If your application allows user to use your application with multiple sessions
, then add a second load test which test it also

Related

How to simulate 5000 user login in 30min with MS accounts

We have a system to simulate 5000 users accessing the system concurrently in the 30-minute time span. It uses Microsoft online login accounts and authenticated users are redirected to the system.
Note: We have a limited number of user accounts for the testing. (20 user account)
User logins throughput = 5000/(30*60) = 2.78 user logins/second
Considering the limited number of user account following is planned
Use 20 user accounts to simulate 3-5 logins/second for a period of 30 minutes with throughput controlling plugins
Simulate active user in the system with direct API calls
Questions
Is this a correct way to handle the required throughput with a limited number of user accounts?
What are the other options available
In general the best practice is to have 1 to 1 mapping of JMeter thread (virtual user) to a real user. Depending on how does your application treat new logins it might not show the full picture, especially if some background activities are being triggered for each new login. Moreover, libraries, databases, operating systems, application servers, and other middleware tend to cache requests results so 1 user making 5000 calls is not the same as 5000 users making 5000 calls.
Well-behaved load test needs to simulate real usage of the website (or application or service) as close as possible so if you're testing a website that communicates with the backend using API - it's only a part of the traffic from the browser to the destination, in reality, things could be much more complicated like sending relevant headers, downloading embedded resources (remember about client-side caching as well), executing AJAX calls (when different API calls are being invoked by the same user in parallel) and so on. See How to make JMeter behave more like a real browser article for more details.
So recommendations are:
generate another 4980 test users
make sure that each virtual user's network footprint exactly matches the real browser (or other application which you're simulating) one

How to login a large number of users in Jmeter?

I have a project and need to test a large number of of users in Jmeter but the problem I am facing is how to login lots of users, it will be tedious for me to enter their data manually and the token.
Can we remove or bypass the session id/token? So I won't need to input it manually. Is there any simple way to login lacks of user so I can test the load and stress testing. Or is there any other open source tool in which I test this?
I think you should read the Apache JMeter User Manual first.
You work around to be like:
Try to record only one user login session using the Apache JMeter HTTP(S) Test Script Recorder.
Use CSV Dataset Config to pass all your login credentials in JMeter.
Add a Cookie manager in your test plan.
Use regular expression extractor or JSON path processor (Depending on your request type) if you need bypass any data in your subsequent request. Check this article.
You won't be able to simulate one lack users from your machine I guess.Actually, it depends on your hardware configuration. So check for the Distributed testing.
You have run your test in Non-GUI mode. You can use GUI mode for the only debugging purpose.
Do not add any listeners when you perform your load test since they consume more memory.
Try to tweak your JDK heap size accordingly.
Try to use updated JMeter version and JDK both.
It actually depends on your application design, for instance if usernames are matching some pattern like:
user1
user2
user3
etc.
you should be able to just add __threadNum() function as a postfix
If your users are present in a database table you can use JDBC Test Elements to read usernames from the database
When it comes to logging in, it is not about single request which performs login operation, your web application test must always represent real users using real browsers as close as possible, so the login flow should look like:
Open Login Page
Extract token using one of JMeter Post Processors
Perform login providing credentials and the token from the previous step
More information:
Building a Web Test Plan
Building an Advanced Web Test Plan
How To Login Into A Web Application with JMeter

jmeter active threads and csv - is this setup correct

I am using jMeter to load test logging in and logging out of my application. I have a CSV with 500 uname and pwords, and I have also set the active threads to 500.
Is this the correct way to stimulate a load of 500 users?
From technical perspective - yes, JMeter will pick up credentials from CSV and send them along with the request.
However if you think about what happens in reality logging in and immediately logging out doesn't seem a realistic use case for me. The whole idea of load testing a web application is simulating real users as close as possible, it includes:
Application usage scenario(s): how many users will be accessing your application at the same time and what users will be doing what things? For example given Stack OverFlow the vast majority of users are searching for answers by given criteria, some users are typing questions, some of them providing answers, and some of them are commenting. These all are different behavioral patterns which need to be accurately simulated by your load test
Each user should have a "user session" which identifies him so application would distinguish different users so make sure you have HTTP Cookie Manager in your Test Plan
Real users use real browsers which are downloading images, CSS and JavaScript files using parallel thread pool (around 5 concurrent threads) to speed up page loading process. In order to mimic this behavior you need to configure HTTP Request samplers to download embedded resources and do it in parallel. You can apply this configuration to all the HTTP Request samplers via HTTP Request Defaults.
Don't forget to add HTTP Cache Manager to mimic browser cache as real browsers normally cache embedded resources to disk and don't re-request them on subsequent calls.
So I would recommend reviewing your test scenario and/or load pattern and get familiarized with How to make JMeter behave more like a real browser article

Jmeter workflow for Login with access token with multiple threads

I have a django application to be tested using Jmeter. Here is the Workflow
Admin user logs in , gets back access_token
Creates a user, using access_token ,unique mobile and email
Created User resets its password using OTP and a new password
Created user logs into the application.
I am using Reg Ex. extractor for accessing access_token and OTP
I am able to perform this with 5 threads, but as I increase the threads, it fails. Let me know what am I missing. Below is the screen shot Of My Jmeter.
It is not clear what exactly fails. Whole JMeter test? Some specific sampler? Your application? How many users do you add, is it 6 or 600? You need to be more specific and include at least essential failure details.
In the meantime I would suggest the following troubleshooting options:
Add HTTP Cookie Manager to your Test Plan. Given you use > 1 user you need to maintain a separate session for each login.
You need to use a separate admin account for each thread. If you have only one admin account - create users in loop using Loop Controller as your test needs to be realistic.
Run your test in command-line non-GUI mode
Disable all the listeners during test run as they consume a lot of resources (especially View Results Tree one) therefore your test may simply fail due to lack of RAM, see Greedy Listeners - Memory Leeches of Performance Testing for detailed explanation.

JMETER user based or throughput based testing

I want to know how much users the system I am testing can handle and I am confused which test to use in JMeter, user-based where I user specific number of threads or throughput based where I use the throughput timer and from there I calculate the number of concurrent users.
You have answered your question yourself, if you need to know how many users your system is able to handle you need to simulate real users as close as possible, it includes:
Cookies (HTTP Cookie Manager)
Cache (HTTP Cache Manager)
Headers (HTTP Header Manager)
Think Time (Timers)
Your application usage scenarios (user groups distributions)
Start with one and gradually increase the load until response time will start exceeding acceptable or errors start occurring, whatever comes the first.
See How To Make JMeter Behave More Like A Real Browser article for more information on above hints.

Resources