Jmeter for loop http request - parallel - jmeter

I am using JMeter for image load testing.
I have an array of the image name and looping over that array, I am getting all the image via HTTP request.
-> loop_over_image - for loop controller
-> http_request sampler
for now, it will loop and fetch images via HTTP sampler one by one.
It is possible to make these request parallel.
I am looping over 300 images - means 300 HTTP request, it is taking more than 5 minutes, but in chrome, it is taking 30 seconds because chrome API requests are ASYNC - means kind of parallel.
Is there any way to make these 300 request parallel. I don't think it is possible, because the loop will go to each image one by one.

I am looking for the same solution.
I am extracting from an HTTP response a list of urls and assigning them into a variable (as array).
Parallel controller will not work in this case, since it does not accept an array as an input.
I think that there is not simple way to do it (possible using Java and JSR223Sampler).
JMeter dev community should add this feature to JMeter.
I've opened an enhancement request https://bz.apache.org/bugzilla/show_bug.cgi?id=63526
Please vote up on it, so it will be implemented.

Try with parallel controller or sampler.
Kindly check the below link:-
https://github.com/Blazemeter/jmeter-bzm-plugins/blob/master/parallel/Parallel.md
Hope this helps.

Related

How to clear cache for a sampler in JMeter

I have a jmeter script where I need to open a page multiple times. Hence, I kept this action under loop controller. What I observed is the response time of loading page is decreasing for every iteration. This could be due to caching. Can anyone help me on how to clear cache for this sampler after every iteration (I am referring to loop controller iteration here not thread group one).
Your requirement doesn't really make a lot of sense as well-behaved JMeter test should represent a real user using a real browser and real browsers caching strategy assumes minimizing the amount of downloaded assets by obeying Cache-Control headers
If you're aware of this good practice and still want to discard the cache for each iteration:
Add JSR223 PreProcessor as a child of the HTTP Request sampler which cache you want to clear
Put the following code into "Script" area:
sampler.getCacheManager().clear()
You can use HTTP Cache Manager in JMeter and check this checkbox to Clear cache each iteration?. You can follow the page to learn more about this. This applies to all the requests in the current thread. I know this is not what you are looking for but JMeter has only this option as UI setting.
Another way can be to use Beanshell PreProcessor to intercept the request and clear the cache on the run.
import org.apache.jmeter.protocol.http.control.CacheManager;
CacheManager clearCache = ctx.getCurrentSampler().getProperty("HTTPSampler.cache_manager").getObjectValue();
clearCache.clear();

In Jmeter - How can i get, how much time taken to navigate a page

While navigating to e.x landing page the blazemeter recorder gives 10 HTTP requests. In this case, how can i get, how much time taken to navigate landing page.
If I summarize all the requests time based on View Results in Table listener, it is more than the reponse time of chrome time hence couldn't get the exact time.
Note: HTTP Request might be sequential or parallel.
Chrome Response time is 4sec but View Results in Table listener sum value is 12sec
I don't think you should have 10 requests, most probably you should have only 1 request.
If remaining 9 requests are for images, scripts, styles, fonts, sounds, etc. - you don't need to add them manually, instead you need to tick Retrieve all embedded resources and Parallel Downloads boxes on "Advanced" tab of the HTTP Request sampler (or even better, HTTP Request Defaults:
If the requests are AJAX - you need to put them under Parallel Controller

Jmeter, delay http request with many extracted urls

i have a issue with to many calls to the server.
I have extracted several urls with the "regex extractor".
In the next step, a "http request" calls these urls by ${extractet-urls}
But all requests after the 8th url gets a error 500 response from the server.
I tried to input several timers between, before and everywhere else, but it hasn't an impact.
So my question is:
how can i delay in this single http request which calls all the extracted urls?
Thanks for your help :)
After the requeat you can add sampler ->Java Request. Then change classname to SleepTest and it'll wait 1 second (configurable)
Add a Constant Timer as a child of the HTTP Request sampler (see Scoping Rules for details) and provide desired delay there (in milliseconds). It will cause the relevant thread to "sleep" for the defined amount of milliseconds before executing the HTTP Request. See A Comprehensive Guide to Using JMeter Timers to learn more about using Timers in JMeter tests.
Another option could be using Test Action sampler to create a delay, it doesn't generate sample result so you won't see it in .jtl results file.
The final approach is depending on what you're trying to achieve and how your test is designed.
Alternatively, you can add a Thread Group and define a ramp up time, then put the request inside this group. The ramp up time takes the startup overload too.

How to measure the Test Fragment response time in jMeter?

My jMeter script performs visiting the Workout history page of the website.
While leading there the app sends 8 api requests. We put them into one Test Fragment but while running scripts in jMeter I get the response time of each HTTP Request.
Is there any possibility to get the response time of the whole Test Fragment?
My Test Fragment screenshot
It is simple. You just add a Transaction Controller in the Test Fragment. Move all the HTTP requests under the Transaction Controller.
If you are looking for only the total time of all the requests, then check the Generate parent sample checkbox.
you could definitely do this in beanshell, start a timer and then calculate the end time.
Also you might try something like the JC#gc package of extra plugins for something like responses over time.

how to run two requests sequentially in jmeter

Need some help on Jmeter for the following scenario please I need to simulate these steps in order to load our application.
a) make a request to a web-service.(done)
b) verify the response for some variables and extract a URL address from the response.(done)
c) Now using the extracted URL need to make another request.(extraction done)
d) in response a media file will be sent.
My Plan consists of "stepping thread group-->(Sampler 1)HTTP Request +couple of listeners for data gathering--> (Sampler 2)HTTP Request +couple of listeners for data gathering. the issue is that when i ran the plan the first sampler generated 4 requests but the second one generated only 2 can you tell me why is it so.
In general how can i simulate all 4 steps in one go for a single thread. I hope that i have cleared myself.
In JMeter each thread runs requests sequentially already.
So in order to do what you expect you'll need to use:
Post Processors called extractors to extract data into variables
Variables to inject in the requests
Read:
https://jmeter.apache.org/usermanual/test_plan.html#postprocessors
https://jmeter.apache.org/usermanual/functions.html#functions

Resources