I am load testing against a Registration system. I currently have a JMeter script that pulls user information from a CSV file (CSV Data Set Config) and my Thread Group has the following steps:
Contact CAS server, get login ticket
Login to CAS
Execute tasks in Registration system
Logout of CAS
JMeter runs through each of those steps as a separate thread and the script works.
The problem is that our test isn't quite accurate when compared against the behavior of our users in real life. Like I mentioned, this is a Registration system, and our end users are logging in and authenticating (via CAS) minutes before they actually begin hammering the actual system (when Registration opens at midnight - and the floodgates open).
In real life we never have problems with our CAS authentication system because we don't have thousands of users authenticating at once. When we do our load testing with JMeter the first two steps are to authenticate via CAS, and this makes CAS a bottleneck and it begins to fail when we load test with 500 users over a span of 10 seconds. As such, our load testing transactions aren't able to hit the actual Registration system and the JMeter load test isn't valid.
Is there a way to update a JMeter script to log all users in first (loop through the first two steps and maintain the CAS session info for all users), and then perform the rest of the steps?
Stirling,
Please use 'Synchronizing Timer' element of the JMeter that will wait for all the users to login and then move forward to the next step (Registration System).
You can create your script in following structure:
HTTP Request for Contact CAS server, get login ticket
HTTP Request for Login to CAS
Synchronizing Timer [Set the 'Number of Simulated Users to Group by' to 0 and Timeout based on your requirement [Recommended value to set is '300000' i.e 5 minutes]. Do not set Timeout to '0' otherwise your test will remain in running state forever if any of the users gets failed in the previous step]
HTTP Request for Execute tasks in Registration system
HTTP Request for Logout of CAS
When the test completes 'HTTP Request for Login to CAS' step then it will wait for all the users to reach at that step before moving to 'HTTP Request for Execute tasks in Registration system' step.
If you need information related to other JMeter elements then you can refer to JMeter knowledge base to get all the critical information at one place.
Kindly let me know if you have any questions.
Related
I could somehow run JMeter test for a user but running HTTP requests a few time such like (multiple users). The problem is that authentication only supports one session and I don't think it's ok to create 50 users in LDAP to be able to test. I tried to use 'Parallel Controller' but after executing the first request the others have the status 'Socket closed'.
I don't think it's ok to create 50 users in LDAP to be able to test
I think this is what you should be really doing.
Parallel Controller is a kind of workaround to bypass JMeter Threads Model limitation when it comes to implementing specific test scenarios like simulating AJAX requests because it assumes several requests executing in parallel triggered by a single thread (virtual user)
In the majority of cases user does sequential actions like open login page -> login -> navigate somewhere -> type something -> etc.
Ideally each JMeter thread (virtual user) must represent a real user with unique credentials so I would strongly recommend either creating as many users as you need to simulate in LDAP, if you're not allowed to have test users in LDAP on permanent basis you can even create them from JMeter like:
setUp Thread Group - create users
normal Thread Group with your main test actions
tearDown Thread Group - delete users
See How to Load Test LDAP with Apache JMeter article to learn more about different types of LDAP requests you can send from JMeter
I need to perform the task to include the following scenerio :
2 different admin edit the same customer profile concurrently
What shall i be doing to configure this concurrent testing .
I have made Login thread Group where i used CSV config element to have different login at same time . But i have kept header manager which extract the authentication token from the last login only and edit customer profile is done through the last logged in admin . How can i make 2 different users to edit the customer profile at the same time i.e concurrently ?
As per JMeter Documentation
Variables are local to a thread
So if you have 2 threads (virtual users) each of them will have its own authentication token (given you really have 2 admin accounts and use different credentials)
Also be aware that the only way to ensure concurrency in order to have requests occur at exactly the same moment is using Synchronizing Timer. If you don't use the timer - JMeter will be trying to send requests by each thread as fast as it can, it may lead to concurrent requests but you don't have any guarantee, especially when it comes to 2 users only.
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.
My application is live application & three is a heavy use of AAJX call and Java scripts.
Successful login required three steps
Login validation
On login page browser post user login information and backed first validate it and set cookies & session id for further use.
After successfully validation of user information browser initiate two request parallel towards back-end.
Browser post a request to server & server send some XML data in every 10 seconds towards browser. Back-end push information in every 10 seconds up to user logged in.
Also browser post a ping request to server to make sure user is available and active.
To test the performance of UI by JMeter I am planning to create following test plan.
Test Plan
Main Login Thread
Ping Thread
Application Thread
Now I want to run thread 2 & 3 parallel after completion of first thread.
Please let me know if this is possible in JMeter if Yes how I can run two threads parallel after completion of first.
It isn't something which is provided in JMeter out-of-the-box as currently there is no way to jump over the number of threads which are defined on Thread Group level so you'll need to do some coding in order to work it around, i.e.:
Use JSR223 Sampler (or PostProcessor)
Develop custom sampler i.e. basing on ExampleSampler which spawns more threads in order to simulate AJAX parallel calls
See How to Load Test AJAX/XHR Enabled Sites With JMeter article for more details and some reference implementation examples.
In Jmeter, I have a thread group with 20 http sampler, added HTTP Cookie manager and session is been handled through JSESSIONID.
When I run a script for multiple users with > 10 threads, the first few threads are running properly, thereafter some HTTP samplers of other threads are failed with an error (on the web page): "Your Session is logged out. Please close current window and try login to the application once again."
When I did further analysis, different JSESSIONIDs are passed in between within the same thread.
Please have a look on how a different session id passed for the samplers in same threads and provide a solution for this.
Note: When I run this for a minimal number of users like 2, I don't get this issue.
Two options available
If you are using URL redirects And come back to main url,you may get different jsessionid And its depend on your server configuration you have,you need to use proper regular expression to extract the session and to bind in next call
If you are using same credentials for various threads And if your server config don't have the capability to manage it you may get various jsessionid