JMeter - Samplers fail when running distributed in stripped batch mode - jmeter

In my test I run a script sampler(BSF Sampler) that uses the result of the HTTP Request Sampler before it.
The problem is that when I run the test, distributed, in mode=StrippedBatch (the default mode) the script sampler fails.
Here's a striped down wersion of my script: (the result is 0)
bytes = prev.getResponseData();
OUT.println(bytes.length);
I have tryed the test localy and also distributed in mode=Standard and it works fine (the problem is not present).
Does this mean that slave can't access the result of the samplers, if the data is not send to the master? Isn't that a big hit on the performance?

StrippedBatch mode does this:
result.setBytes(result.getBytes());
result.setResponseData(new byte[0]);
Which is why you get your "strange" results.
Your option would be to do it in Post Processor and save your var in Thread Variables.
But it is not a good thing to save the full response as it can consume a lot of memory.

Related

Threads are in blocked state when JMeter script is executed [non-gui mode]

I am running the JMeter script with 100 RPS/TPS using Throughput Shaping Timer on Linux VM using Non-GUI mode, as I am not able to reach the desired TPS/RPS with enough RAM and CPU resource available.
I took the ThreadDump and saw that 195 Threads out of 200 Threads are in Blocked State. Thread Dump Analysis is available on:
Thread Dump Analysis
This is the API Script which needs dynamic headers generation before each Request is executed. Dynamic headers are as follows:
contentMD5 - MD5 hash of request body
client - clientTypeAPP
nonce - unique current timestamp
apikey - sha512Hmac of the string generated by concatenating Methods, body, path, md5 etc.
The above headers are generated using the JSR223 Pre Processor. The generated headers are also removed using JSR223 Post Processor after Sampler execution.
The thread dump shows that the problem is with your JSR223 Test Elements, most probably there is an issue with your Groovy code and most probably you're inlining JMeter Functions or Variables there
Make sure to remove all occurrences of calls to functions or variables from the code
Try using script files rather than putting your code into JSR223 test elements
Use a profiler tool to get to the bottom of your code issues
If you hit the limits of the Groovy scripting engine performance consider either moving your custom code logic into a JMeter Plugin or switching to Distributed Testing

Jmeter hml request order get change when increase the number of users and due to that post reguler expression get failed

I record and run the Jmeter script by keeping number of users = 1, in tread group.
Results tree output:
I increased the number of users to 3 and result tree output order changed.
Therefore my some of regular expression exacter logics get failed and resultant responses failed. How can I avoid this situation.
Is there way to manage result tree execution order.
If your regular expressions are under the requests and not at the same level as of HTTP requests then it should not be a problem.Every thread/vUser will run independently. But, in view results you will see request as and when executed by different threads and not in sequence.
As per JMeter Functions and Variables user manual chapter:
Variables are local to a thread
Each JMeter thread (virtual user) executes Samplers upside down (or according to the Logic Controllers). JMeter threads are absolutely independent from each other and each thread has its own variables.
So the problem must be somewhere else, inspect the state of the variables using Debug Sampler and the response data for /oauth calls - it might simply not contain the necessary token value.
Also there is a suspicious call to bundle.js, my expectation is that you should not be executing it directly. The good practices is to configure HTTP Request Defaults to download embedded resources and use parallel pool to be closer to what real browsers do.
See Web Testing with JMeter: How To Properly Handle Embedded Resources in HTML Responses article for more detailed explanation.

Extract value and add it in HTTP Request name

I am trying to extract a value from one HTTP responseand add it in another HTTP Request name. It works, but when I run many threads, for example, 100 or more, the regex value is not displayed in the HTTP Request name. Instead it displays the default value. If the thread number is 100, then 10-15 are with the default value. what could be the reason?
It means that the server does not support 100 users load as it sending some other response (may by 5** HTTP response codes). save the results in .csv/.jtl file and check whether these error codes are observed.
If your script is working for a few users, but not working when load is increased, then it is the fault at server side where its resources might have touched the bottlenecks.
I suggest the following steps to try:
Increase the Heap space for JMeter (which is a Java application). default value is 512MB. increase the value in jmeter.bat.
set HEAP=-Xms1024m -Xmx2048m
Run the JMeter in non-GUI mode to save the resources.
while running the load testing using non-gui mode, specify -l results.jtl to save the results. once the test is completed, check for status codes under responseCode column.

Jmeter stop test when time reaches threshold

We're running a test case for load testing, over different servers. What we want to do is, given that test case, stop if we can see a performance decrease, based on a response time threshold.
What we have now is threadgroup defined, and inside it, an HTTP request defined plus a view table for output. What should I do to put this control in there?
Add Duration Assertion and specify threshold there
In your Thread Group set "Action to be taken after a Sampler error" to Stop Test.
Above steps will stop your test after first occurrence of response time exceeding the threshold.
See How to Use JMeter Assertions in Three Easy Steps article for more information on how to conditionally set pass/fail criteria in your JMeter test.
P.S.
Remove View Results Table listener (or disable it) during load test execution as it consumes a lot of resources.
Run your load test in non-GUI mode as JMeter GUI is not designed for running the actual load test and may be a bottleneck in case of more or less severe load.

Simulate millions of users with 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.

Resources