OutOfMemory Exception in JMeter - jmeter

I am running JMeter test on machine having 12 GB RAM but I am getting 'OutOfMemory: Heap Space' exception while running the test for 100 users only.
My script has around 300 http requests and is of sync with server scenario.
I have already increased the max heap to 8 GB and tried running the test in Non-GUI mode after disabling all the listeners.
Moreover, I have other script of same application and they are working fine with 200 users load.
Can anyone suggest the changes that I need to do in JMeter for running sync script successfully for 200 users.

As you do not provide much details, it is very hard to answer but check:
that you're not running in GUI mode with View Results Tree as it is an Anti-Practice, if it's the case use NON GUI mode:
https://www.ubik-ingenierie.com/blog/jmeter_performance_tuning_tips/
http://jmeter.apache.org/usermanual/best-practices
in jmeter.log that the allocated heap is really what you think
that you have not allocated as much heap as you have RAM, you need to give some memory to the OS (300 MB)
That you're running last jmeter version and not an old one

Related

How to run 4000 users in Azure VM

My scenario is to run 4000 users in 1 hour for a product search. I tried to set it up using the GUI and ran with 1000 users. But in my local system, it's not running and my Jmeter is hanging. What I did is, have created an Azure VM configuration as 8 Core processor, 32GB RAM, and it's a windows machine. But this time I checked my baseline with 5 users in GUI mode. Later on, my intention is to increase the load by 50, 100, 500, 1000 and 4000. But When I run with 100 users also in GUI mode Jmeter is hanging. What I did is I ran the script in Non-GUI mode. But with 50 users I was able to run and getting the result. When I increase the load to 100, Java heap memory exception is getting. Can anyone suggest me how run this scenario is Azure VM. In regular machine, it's not working so only I have gone through Azure VM.
Let me know if anything is needed from my end.
Don't run your tests in GUI mode, it's only for tests development and debugging. For real load test execution always use non-GUI mode
Make sure to follow JMeter Best Practices
Increase JVM Heap size, by default JMeter 5.4.1 comes with 1 GB heap allocation which might not be sufficient for your case, i.e. line #151 of jmeter.bat startup script looks like:
set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m
this -Xmx1g stanza tells JVM to not to use more than 1 GB for the heap space, you might want to ramp-up it to i.e. 24g
See 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure article for more details
Even if you manage to run the test with 4000 users on this VM make sure to monitor its resources (CPU, RAM, Network, pagefile usage, etc.) as it might be the case it will be overloaded and will not be able to send the requests fast enough, in this case you will need to add another VM and run JMeter in distributed mode
There's a couple of comments I have to do here
First thigs first, you should never run your JMeter performance test using the GUI as specified in their documentation
Don't run load test using GUI mode !
GUI mode is for designing and quick testing things. I'd say that even JMeter tells you that when you start it from the CLI
Second, it seems that you're facing vertically scaling limitations (JIC, we say that we're scaling vertically when we put "a bigger machine" to work). When you start getting into a high number of users (such as 4000) scaling vertically starts to show some issues, and while possible you should try to go for an horizontal scaling strategy (JIC, we say that we're scaling horizontally when we put more machines to work in parallel)
Luckily, JMeter supports horizontal scaling out of the box. They call it Distributed Testing
As a summary, you'll need to perform the following steps:
Setup several machines, they don't need to be super big machines. I'd recommend you playing around a little bit with the specs. I'd say to go with a machine that can support 250-500 users
Configure these machines to act as worker nodes
Make sure to start them in CLI mode!
Start your controller node. This can be your own local machine
Since you won't be running load, you can start it in GUI mode!
Run your tests
While they're running, I'd recommend monitoring the worker nodes as well
Start just with one node and, once you have it working, add the rest of nodes
As an extra step, you could configure some scripts (or even better, a CICD pipeline) to rampup dynamically the required number of worker nodes based of the number of users you want. If we maintain the 500 users/machine, you'd need 8 nodes for your 4k users. But potentially you might need to repeat the scenario with 10k or more users

Large file download testing

I am using JMeter to test downloading of a large file (500 MB) from a server. I want to find out how much parallel downloads the server can support.
I created a test plan with 1000 threads and HTTP Request sampler. I ran the test. But all my requests failed with error like below:
2019-05-06 18:07:33,884 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-11
2019-05-06 18:07:33,884 ERROR o.a.j.JMeter: Uncaught exception:
java.lang.OutOfMemoryError: Java heap space
I googled and found out that increasing the max heap size will fix the issue. So what I concluded is JMeter is downloading the file into RAM. So if there are two parallel downloads of 400 MB going on then 800 MB of RAM will be used. But obviously this is not practical since I have to test for 500 parallel downloads.
I am thinking if I can configure the HTTPRequest sampler to store the downloaded content into disk instead of storing it in RAM or just ignore it (download and discard immediately). This would allow me to test for 500 parallel downloads, which is what I want to achieve.
If anyone knows how to do this please help me with this or let me know if there is an alternate approach.
Try to create a distributed system of Jmeter(master- slave setup) . Note that the JAVA heap space of JMETER on each slave should be more than 6 GB(or more) for example. If you have enough slaves to run, the load sending will be distributed eventually among the slaves and this might solve your issue.
If the issue still persists, Consider movinf the same JMETER distributed configuration to AWS- But this is a huge step.
Just give a try with the first point mentioned.
Additional Note: Please also try by disabling heap dump creation. To remove this Comment DUMP="-XX:+HeapDumpOnOutOfMemoryError" line from JMeter.bat file.
After googling a bit more I realized JMeter does not have any such option but there are other tools which do the same job more efficiently. Here are some of those I tried.
wrk
apache ab
and many more listed here.

samples in aggregate report in jmeter

I am running a test for testing if my application is able to handle 250 concurrent users or not.first time when I ran the test,results were fine and number of samples generated in aggregate report is also fine but when I am running the same test again,i am getting drastic changes in aggregate report.This time number of samples got reduced and also the response time got higher.Whereas cpu usage and memory usage is fine and database server performance is also good.For this I am using stepping thread group.
please help me to get rid out of it.
What about CPU and RAM usage on the host, you're running JMeter on? Make sure that:
You running JMeter in non-GUI mode
You have all the listeners disabled
You have only absolutely minimum of pre/post processors and assertions added/enabled
JMeter has enough JVM heap space (70-80% of your total physical RAM)
See JMeter Performance and Tuning Tips for detailed explanations and more JMeter configuration tricks
Depending on the logic your application has you might not be able to handle 250 threads on single machine (not enough computing resources RAM, NIC bandwidth etc) You haven't provided details about your machine utilization during the run test and Jmeter logs for any warnings or errors. Check that.
We had the same kind of issues when we were testing heavy application (with sessions and long user flows). Master-slave config can fully resolve the issue.

multiple user/thread logins with different inputs in jMeter

I have created a test plan for creating userprofile.
I want to run my test plan for 100 users but when i run it for 10 users then it is running successfully with rump up time of 2 sec; but when i try it for 100 users & more than that it is getting failed I am giving rump uptime of 40 sec for 100 users.
I am not able to understand what may be the problem with it.
In my test plan the thread user are differentiated with id
Thanks in Advance.
It's a wide question, this behavior can be caused by
Your application under test can't handle load of 100 threads. Check logs for errors and make sure that application/web server and/or database configuration allow 100+ concurrent connections. Also you can check "Latency" metric to see if there is a problem with infrastructure or application itself.
Your load generator machine can't create 100 concurrent threads. If so - you'll need to consider JMeter Distributed Testing
Your script isn't optimized. I.e. using memory-consuming listeners like "View Results Tree", any graph listeners, regular expression extractors. Try following JMeter Performance and Tuning Tips guide and see whether it resolves your issue.
Agree with Dmitri, reason could be one of the above three.
One more thing you can try.
You can run your jmeter in ui mode for validation of your script and after validation you can run it in non-ui mode which will save lot of memory and cpu processing (basically UI is heaviest part in jmeter).
you can run your jmeter script in non-ui mode like this,
Jmeter -n -t -H proxy -P port
generally on a single dual core machine with 2 GB ram (Load Generator in your case) 100 user test can be carried out successfully.
some more things you can look at to find out the actual bottleneck
1.check application server logs (server on which your application is hosted)
if there are any failures in that then see performance counters on server (CPU, Memory, network etc) to see anything is overloaded.
(if server is windows then check using perfmon if linux then try sar)
if something is overloaded then reason is your app server cant take load of 100 users
probably try tuning it more.
2.check load generator system performance counters (JVM heap usage,CPU,Memory etc)
if JVM heap size is small enough try increasing it but if other counters are overloaded then try distributed load testing.
3.remove unwanted/heavy listeners, assertion from script.
maybe this will help :)

JMeter hangs during performance testing

I am trying to simulate 100 threads request with 4 different users, all the 97 requests were sent and received but the remaining 3 requests still showing as executing.
I have to manually stop the Jmeter and then only the remaining request are passed.
Why is this happening?
Your machine probably doesn't have the resources to execute the requests or Java isn't configured appropriately. Take a look at this article and this one
In case you are running jmeter in a window mode, please check for attributes provided for heap memory etc. (those should not exceed more than half of the RAM on the machine you are running upon)

Resources