Simulate millions of users with JMeter - jmeter

I have a system that should be able to handle millions of users requests concurrently. In order to check how the system handles the load, I setup a cluster of JMeter servers (slaves), and one controller (client).
I have a database of all users (~10M), and I need each request sent to be from a different user.
I am wondering how I can implement such a thing in JMeter. Basically, I thought about dividing a range of users (let's say 100,000) per each slave, and then within a given slave, each request should read a new user from the local 100,000 list, and delete it. Thus, I will eventually send a request from every user.
The thing is while this idea sounds logical theoretically, I do not exactly know how to implement it using the JMeter terms. Also, I am not sure how to read from database in the test, although I could theoretically read it in advance into a text file, and have each slave contain the text file with its 100,000 users portion.
I can setup a very large cluster of machines, so scale will not be the issue here. Just how to set it all up.

The best way to provide Jmeter with a list of parameters is to use a CSV file:
http://jmeter.apache.org/usermanual/component_reference.html#CSV_Data_Set_Config
You can configure the CSV dataset config to do make every thread use a different line in the CSV. Each engine will need to have it’s own unique CSV file, because the sharing mode does nto work between engines in distributed testing (you can try to automate this part, this can be interesting to do :) ).
This is how your script should look like:
1. Thread Group
1.1 HTTP sampler (login)
1.1.1 CSV dataset config
1.2 second http sampler
etc...
The login sampler will use the parameters loaded by from the CSV file, so for every ’login’ it will use a different line.
Distributed testing is pretty simple:
http://jmeter.apache.org/usermanual/remote-test.html
Keep in mind that running 100K concurrent users on a single Jmeter load engine will be hard (Jmeter consumes resources on the server, so you will need lots of CPU and memory). So you should also monitor the engines.
Also 1M users will cause a lot of data that the engines will send back to the console, so you might need to start a bunch of distributed tests in parallel, and at the end aggregate the results.
Cheers,

This is can be implemented by doing the following steps:
Taking the user credential dump and saving it to a csv file
split the csv file. copy 1 file to each Jmeter slave, in the same location on all the
machines e.g. "C:\Loadtest\"
from the controller, give the path of your csv file in "CSV Data Set Config".
Run the Test.
By doing the above steps, Jmeter controller will start execution of the test by pointing all the Jmeter Slave nodes to use the CSV file in the same location "C:\Loadtest\".
But the trick here is that all the machine will be using different set of users.
Hope this will help.

Related

I am not able to record place order activity and perform load testing on randomly generated URL

at the time of recording activity I am recording complete activity till place order, but when run the same action for 5 times, in result everytime its hitting same URL that has been generated while recording, but because of it place order not recording to my admin account.
In the majority of cases unfortunately you will not be able to successfully replay the recorded script because modern web applications widely use dynamic parameters for various reasons like client side state tracking or security reasons.
So you need to parameterize and/or correlate your test and replace recorded hard-coded values with either dynamic parameters which needs to be extracted from the previous response using a suitable JMeter Post-Processor or provide random values or use pre-defined values from i.e. external CSV file.
The easiest way of detecting dynamic parameters is recording your test one more time and comparing 2 recorded script - the parameters which will differ will require your attention.
You can also consider using an alternative recording solution which is capable of exporting recorded scripts in "SmartJMX" mode with automatic detection and correlation of the dynamic values, check out How to Cut Your JMeter Scripting Time by 80% article for more details.

Recording application using template

I have recorded my web application through template & just to confirm that load test result which i am getting is correct? Just by increasing No of users does it give proper results? Is it enough for load testing of web application?
First of all you need to ensure that your test does what it is supposed to be doing. Recorded tests can rarely be successfully replayed, so normally you should be acting as follows:
Add View Results Tree listener and run your test with 1 user. Inspect request and response details to verify your test steps.
Perform correlation and parametrization if required.
Correlation: the process of identifying and handling any dynamic parameters. Most often people use Regular Expression Extractor for it.
Parametrization: the process of making your test data driven. For example, if your application assumes multiple authenticated users you need to store the credentials somewhere. Most commonly used test element for this is CSV Data Set Config
Make your test realistic. Virtual users simulated by JMeter need to represent real users using real browsers as close as possible with all the related stuff: cookies, headers, cache, etc. See How To Make JMeter Behave More Like A Real Browser to learn how to configure JMeter to act closer to real users. Also real users need some time to "think" between operations so make sure you are using Timers to simulate this behaviour as well.
Only after you apply the above points you should add more virtual users. Again, run your test with 2-3 users and iterations to ensure your test funcitons as designed. Once you are happy with it you can increase the load, but don't overkill your server, increase the load gradually and check the impact of the increasing load on your application, i.e. how response time, throughput and number of errors change as you increase the load. The same is applicable for decreasing the load, don't turn it off at once, decrease the number of virtual users gradually.
Building a Web Test Plan
Building an Advanced Web Test Plan

Generating graphs from distributed test seems to give results for one client/slave

I'm running a distributed test using 5 JMeter clients (slaves). Each client is set to run 50 users. At the conclusion of the test I generate a series of graphs from the resulting JTL along with a SynthesisReport. The SynthesisReport details 250 samples for each request, as you'd expect, however the TimeVsThreads and the ThreadsStateOverTime peak at 50 users, as if they were showing the results from just one of the clients.
I've confirmed that the jmeter.properties files for each client are the same as I suspected that it was possibly an issue with the each clients results file configuration and settings for saveservice.
I can't imagine this is by design, has anyone experienced something similar and if so how did was it solved?
As per documentation:
http://jmeter-plugins.org/wiki/ActiveThreadsOverTime/
Just name your thread groups using a unique id for each generator ( hostname or a property you pass to injector and use with function __P if you have more than 1 injector per host) and it will work fine.
This is normal for Jmeter Distributed Testing.
The reason this occurs is that each load generator separately starts User Threads 1-50, so when cmdrunner runs, it sees 1 responses from each User Thread 1 (5 total), but can't differentiate between them.
If you're using a custom reporter tool (that wraps cmdrunner), you can multiply your peak users by your load generators to display a more accurate number at the top of your Report. But as long as you're calling cmdrunner, you won't be able to see the actual number of users on your graphs.
This is normal behavior of JMeter. 5 clients will run each 50 threads.
Open JMeter and run on all remote hosts, and check Active threads each will run 50 threads.

Plotting JMeter test results dynamically in HTML chart

I want to be able to run a JMeter test for thousands of users and plot the results dynamically using a JQuery based charting library like HighCharts i.e. the response from every virtual user must be plotted in near real time to show a stock ticker like chart which gets updated dynamically. I am OK running the test in Non-GUI mode.
I have tried the following,
- Run the JMeter test in non-GUI mode and write the response to a file. What I notice is that the results get written to the file in a buffered manner which means even if I have a program monitoring the file for new records, I wont get it in real time.
I am looking for suggestions on how this can be achieved
1. Do I need to write a custom JMeter plugin? In this case how will it work?
2. Is there some listener which can give me the desired data
3. Can this be done via post processor?
I have seen real time reporting being done on some cloud based load testing websites which use JMeter, so I'm sure it can be done, but how?
There is some buffering when writing to a file, but it shouldn't be more than a few seconds worth of data.
I'd go with the route of reading the log file into something like statsD using something like logstash.net and from there you can probably find an existing solution that pushes it to a chart.
You can disable buffering by adding this in user.properties file:
jmeter.save.saveservice.autoflush=true
This impacts slightly performances for test that have low or no pauses.
To do what you want you could use this kind of library:
http://www.chartjs.org/

Running A Large List of Files Once and Only Once in JMeter (Possibly in a Particular Order)

I'm trying to run around 15000 soap requests through JMeter. I have 15000 individual soap files in a folder.
I know that the WebService(SOAP) Request component has the option to point to a folder.
But, the problem is that the files in the folder will get picked up and run randomly and a file can get run multiple times.
This is not ideal because each request has a unique correlation id and if a file get's run twice, the second run will fail due to a duplicated correlation id.
Is there anyway, I could tell jmeter to run the files only once?
Also, as certain soap requests are dependent upon other request having already run, the ability to run these in a specified order would be desirable. Is this possible?
These seem like common problems that should have already been solved. But, I can't find much on google.
Do you guys have any ideas?
I would use the JSR223 Sampler to run a script (e.g. Groovy) to iterate through the files in the directory and store the text of each file in a String.
See, for example, this other answer about using a Groovy script to iterate a list of values.
You could put the data into a csv file and read it in using a CSV Data Set Config. If you need unique values over multiple threads then you have to create multiple files, one per thread.
You could also put the data in a database and use a JDBC Config/Sampler to access it, making sure to either a: delete the data after it is read, or b: mark it as 'read' using a flag. Both methods would prevent the same record being read twice by different threads.
If you need to run requests in order you should structure the test plan as such, requests will be made sequentially, top to bottom.

Resources