I am now using Jmeter to run the stress test on APIs. When I stopped the test manually by pressing the stop button, Jmeter would return "socket closed exception error".
Therefore, I would like to ask is there any way so that this error will not occur in my reports?
Thanks very much.
Don't use GUI for running the test, it's only for tests development and debugging, you're supposed to run your JMeter test using command-line non-GUI mode.
No matter of the way of execution forcefully stopping the test will result in non-graceful connections termination, you should rather set fixed number of iterations and/or duration in the Thread Group and wait for the test completion
If you really need to manually stop the test you can use shutdown.cmd script (lives in "bin" folder of your JMeter installation
And finally you can remove "unwanted" results i.e. in last X seconds of the test using Filter Results Tool
Related
When I run Jmeter from Windows CLI, after some random time, the tests are being stopped or stuck. I can click on ctrl+C (one time) just to refresh the run but part of the request will be lost during the time it was stuck.
Take a look at jmeter.log file, normally it should be possible to figure out what's wrong by looking at messages there. If you don't see any suspicious entries there - you can increase JMeter's logging verbosity by changing values in logj2.xml file or via -L command-line parameters.
Take a thread dump and see what exactly threads are doing when they're "stuck"
If you're using HTTP Request samplers be aware that JMeter will wait for the result forever and if the application fails to respond at all - your test will never end so you need to set reasonable timeouts.
Make sure to follow JMeter Best Practices
Take a look at resources consumption like CPU, RAM, etc. - if your machine is overloaded and cannot conduct the required load you will need to switch to distributed testing
There are several approaches to debugging a JMeter test which can be combined as a general systematic approach that I capable of diagnosing most problems.
The first thing that I would suggest is running the test within the JMeter GUI to visualize the test execution. For this you may want to add a View Results Tree listener which will provide you with real time results from each request generated:
Another way you can monitor your test execution in real time within the JMeter GUI is with the Log Viewer. If any exceptions are encountered during your test execution you will see detailed output in this window. This can be found under the Options menu:
Beyond this, JMeter records output files which are often very useful in debugging you load tests. Both the .log file and the .jtl file will provide a time stamped history of every action your test performs. From there you can likely track down the offending request or error if your test unexpectedly hangs:
If you do decide to move your test into the cloud using a service that hosts your test, you may be able to ascertain more information through that platform. Here is a comprehensive example on how to debug JMeter load tests that covers the above approaches as well as more advanced concepts. Using a cloud load test provider can provide your test will additional network and machine resources beyond what your local machine can, if the problem is related to a performance bottleneck.
After setting the duration of JMeter, sometimes several threads will fail to stop. No requests will be found, and no errors will be reported. The interface service will not stop the last few threads even after the JMeter is shut down
You're violating probably the most important JMeter Best Practice:
GUI mode is only for tests development and debugging, when it comes to test execution you should be running it in command-line non-GUI mode and this is what JMeter says each time you launch it:
If you still want to know the reason of thread getting stuck - take a thread dump (if you can use the GUI still):
and inspect what this thread is doing and where/by what it's blocked. If you cannot use GUI the thread dump can be taken by command-line tools
More information on JMeter tuning for maximum performance: 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure
I am new to Jmeter
I just wanted to stop the execution of all threads when find error in any of the threads.
I gone through many blogs and I used Action to be taken after Sampler error as Stop Thread and Stop thread etc.
Still I didn't see threads getting stopped in Jmeter GUI.
What to use if I want to see thread stopping when find any error while running threads.
Eg
Threads :500
Rampup: 5 Sec
If thread fail at 450 thread then I should see
#samples as 450 amd error % as 0.01(or something )in Summary report.
Is it possible?
It is possible only if you run your test with 1 thread, when you have more than one thread you will run into the situation when there are several threads online executing Samplers and when the error occurs JMeter will either ask threads to stop or tell them to stop resulting in more sample results than you expect.
Also according to JMeter Best Practices you're not supposed to be running your test in GUI mode, it's only for tests development and debugging, when it comes to test execution you need to run your JMeter tests in command-line non-GUI mode like:
jmeter -n -t test.jmx -l result.jtl
However it doesn't explain the results you're getting, I wouldn't expect exactly 1000 sample results given your configuration so if you want to get to the bottom of the issue you will need update your question with test plan overview, .jtl file and jmeter.log file contents.
I have a very simple test plan in JMeter. There is just one thread group with one get request. ( I created this to isolate an issue which I faced in another real world test plan)
I was trying to increase the load and analyse the result.
While reaching a point, say 5000 users, JMeter does not stop.
I was unable to manually stop or shutdown. While trying to do so, the following message is displayed. But there is no response after that even though I waited.
It says you can see the active number of threads in the upper right hand side, but I can see that there are no active threads.
If I go to task manager to end the task, the same pop up message is displayed in JMeter and hence I am not able to end the task.
Please can someone advise on why I am getting this message when I could not see active threads in JMeter UI.
You're violating one of the most important JMeter best practices: GUI mode is only for tests development and/or debugging
If you want to execute your load test with 5000 virtual users you should be running JMeter in command-line non-GUI mode like:
jmeter -n -t /path/to/your/test.jmx -l /path/to/result.jtl
Once your test finishes you can open the result.jtl file with the Listener of your choice or generate HTML Reporting Dashboard from it
We observed that while executing the below scenario, calls at the end of script execution are failing and they are counted as part of error %,
Scenario:
Number of threads : 100 (even for 50 , 150 200 users, only the calls which are shown at the end of results tree are failing)
Ramp up period : 5s
Scheduler duration : 600s
We also observed that though the sceduled time is for 10mins(600s), jmeter runs for 11mins. Is there any option in jmeter for a ramp-down period?
This may happen when JMeter forcibly terminates running threads, ideally that should not be happening and threads should be stopped gracefully.
The most possible reason is simply lack of resources as you are using JMeter in a not very correct way.
You should not use JMeter GUI for tests execution, GUI mode is only for tests development and debugging
You should not use any listeners during test execution. Run your test in non-GUI mode, store results into .jtl file and after test finishes either generate HTML Reporting Dashboard or open the results file with the listener of your choice, but do this after test completion, not during the test.
With regards to "ramp-down" period: there are some custom Thread Groups available via JMeter Plugins project like Stepping Thread Group or Ultimate Thread Group which allow you to set up arbitrary rampdown patterns: