Jmeter throws 403 forbidden when calling multiple threads - jmeter

I am using jmeter to perform load testing on my dev cluster. I have used HTTP Authorization Manager and have passed baseurl, username, password etc. Now my thread group have:
Number of threads:100 ,
Ramp-up period: 1 and Loop Count:1
Now for the first 50-60 calls the authorization works as expected but later it starts failing by giving error as 403. can anyone please tell me how to fix this?
I am using jmeter 5.4.1

Is there any response data? Perhaps you are getting rate limited. I also noticed you are reading in variables from a CSV. Are you sure the data in each row is correct? If you are providing auth credentials through the CSV, an incorrect row could lead to a 403.
As a side note, JMeter 5.4.1 has a log4j vulnerability, you might want to upgrade it to the latest version.

If the problem occurs under the load I can think of 2 possible reasons:
Your application gets overloaded and cannot properly handle the requests. Check your application logs and resources usage (CPU, RAM, etc.)
JMeter gets overloaded and not being able to properly send the requests. You're violating several JMeter Best Practices in particular:
you're running JMeter in GUI mode, GUI is only for tests development and debugging, when it comes to execution you should be using command-line non-GUI mode
you're using Listeners, especially View Results Tree, they don't add any value and just consuming resources
you're not using the latest version of JMeter, current stable release is 5.4.3

Related

JMeter tests are failing when running with multiple iterations

I recently started using jmeter and created my test cases under the thread group. When I run then with single user or iteration the test pass. But when I ran like 5 iterations. then 2 to 3 tests are failed. Not sure what I am missing here.
jmeter version 5.4.1
The host for the testcases are running on API, not on regular website
ex. peregrine-api-${ENV}-raven.ocp-nonprod.com
Please find the screenshots of my jmeter test setup and let me know if you need any other information
Test plan tree
Testcase settings
Results table
[
This is the response I am getting for few iterations and few runs are executing successfully
{
"message": "An error has taken place",
"errors": [
"An error has taken place"
],
"status": "INTERNAL_SERVER_ERROR"
}
INTERNAL_SERVER_ERROR is a SERVER error, for well-behaved servers it means that there is nothing wrong with the JMeter request, it's server who cannot properly handle the request so it worth checking server logs and look for the reason there
Use View Results Tree listener and compare the request which is successful with the one which fails. If you're using JMeter Properties and/or Variables - the values can be visualized using Debug Sampler
Any reason for using 2 different Thread Groups? If Create Mailbox request requires authentication it makes more sense to keep keycload auth and requests which require authentication under the same Thread Group
According to JMeter Best Practices you should always be using the latest version of JMeter so it worth considering migrating to JMeter 5.4.3 or whatever is the latest stable version which is available at JMeter Downloads page

JMeter - returns 401 unauthorized for few test

I am using jmeter to load test a website. I have tested from 1 to 400 users. however while testing for above 500 users/threads, I am getting 401/unauthorized error for few users. Hope you'll help me to find out a solution to this problem.
I can think of 3 possible reasons:
There is a parameterization problem with your test, i.e. it sends wrong credentials, you can use i.e. Simple Data Writer configured to save requests and response data for failing requests and inspect it using View Results Tree listener.
JMeter gets overloaded and cannot properly perform correlation. In addition to point 1 check whether you're following JMeter Best Practices and ensure that JMeter has enough headroom to operate in terms of CPU, RAM, etc. using i.e. JMeter PerfMon Plugin
Your application gets overloaded and cannot handle 500+ users, check your application logs, resources usage, output of APM tools, etc.

Non Http Response code: url fail to respond Jmeter

Today i got issue Non Http Response code when run script on Jmeter. My script run over some steps (Login - view) but got this issue and have log that issue at NoHttpResponseException.
I'm using Jmeter version 3.3. And I think that maybe this issue from server side, not by my script.
Does anyone fix this issue before? Please support me to resolve it.
This status code is being returned when an Exception occurs during HTTP Request sampler execution. There are hundreds or thousands of possible exceptions and even more potential causes for them.
If it occurs only under the load - most probably it's a server side error and you need to check the application under test logs and monitoring software results to identify the cause
It might be something described in the Connection Reset since JMeter 2.10 ?
It might be the case your JMeter script is badly designed/implemented and you're sending garbage instead of proper HTTP request
So try to collect as much information as you can:
Application under test and JMeter logs (it includes any middleware such as reverse proxies, load balancers, databases, etc.)
Application under test and JMeter machines health metrics (CPU, RAM, Network, Disk, Swap)
Network layer information, i.e. HTTP Request and response details.
Also be aware that according to JMeter Best Practices you should always be using the latest version of JMeter so consider upgrading to JMeter 5.0 (or whatever is the current latest JMeter version available at Downloads page) as soon as it will be possible.

Using AJAX script with JMeter

I am currently working to create test samples for an in-house Java web site using Jmeter for performance testing.
After creating / recording some scripts and re-running them, I found that some scripts are failing (not HTTP failures, the response code was 200 so it was a successful HTTP Response, but looks like server side failures) with an error "Unexpected error occurred, Page is closed". I could not figure out exact reason even after enabling high traces for this application.
I found that this web site is using lot of AJAX Requests for every sample I have collected (or most of them) and they are all recorded with samples ending with ".js". After doing a lot of google search about this issue with Jmeter, I found that Jmeter does not run Javascripts as this is not a browser.
Fair enough, went through some more details and read many solutions that talk about using Selenium web driver to run java scripts and can be used with jmeter to tackle this issue. But none of them talks about exact implementation of webdriver for running javascripts (or Ajax scripts) and having Jmeter running HTTPS Samples.
My Question is two fold:
1) How else I could debug my Jmeter scripts to confirm these errors are caused by Ajax scripts and nothing else and if not Ajax issues, what else is causing this "page closed error"
2) and how do I run web driver for Java scripts and JMeter running http samples in the same test scripts?
Any help or pointers towards a related document is really appreciated. Currently I am completely stuck and don't have any solutions that I could find reading through manuals.
In fact you have 2 choices:
Use WebDriver Sampler to perform real browser testing (this might be very resource intensive as real browsers consume a lot of CPU and RAM)
Use JMeter to execute AJAX calls. JMeter cannot execute JavaScript, but JavaScript-driven HTTP requests can be recorded using i.e. HTTP(S) Test Script Recorder and replayed as JMeter HTTP Request samplers. You will need to apply some custom configuration in order to execute AJAX requests in parallel, check out How to Load Test AJAX/XHR Enabled Sites With JMeter article for details.

Jmeter & browser concurrent requests showing different results?

When I have given 500 concurrent users load via jmeter my server throwing error message but the same time I have called same request via browser showing proper response. How it is possible? Is there any settings in jmeter for avoiding same.
It is hard to say what can go wrong without seeing your JMeter configuration, full server response, JMeter and application under test logs and network dump for browser and JMeter.
The whole idea of performance testing is mimicking real user as close as possible, so you need at least
Add HTTP Request Defaults and set JMeter to:
Download embedded resources
Use concurrent pool of 2-5 threads
Add HTTP Cookie Manager
Add HTTP Cache Manager
Add HTTP Header Manager
Correlate any dynamic parameters
Simulate any specific application behaviour (i.e. AJAX calls)
etc.
In addition to above recommendations: ideally given "good" JMeter you shouldn't see any "response messages", you should see a number of errors in final report so double check you:
Run JMeter in non-GUI mode
Storing only those metrics which are absolutely required
Follow other recommendations from 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure
beside, what Dmitri described above, I would also check the actual throughput the server returns in either cases.
Throughput depends a lot on the timers you configured in Jmeter to simulate think time.
Jmeter has no rendering and no javascript engine, so each thread is much much faster than a real browser.

Resources