I have executed couple of Jmeter tests so far. My test plan in very basic one. I'm using Jmeter 5.2 on mac environment.
Number of threads: 500
Ramp-up period: 1
Loop count 3
[x] Same user on each iteration
[ ] Delay thread creation until needed
[ ] Specify thread life time
Basically according to my configuration above, the test will have 500 different threads being spawned in my JVM while this load test is running.
In order to create 500 threads, Jmeter has time restriction of just 1 second only. So, it will create the one thread in each 0.002 seconds from the moment I start the test.
I'm just hitting to an deployed publicly available service with HTTP POST request with a valid payload.
Now my real question
It is possible that the very first request that Jmeter sends will get the response from the server in just 0.2 seconds(200ms). What happens to that thread from that moment? Will this thread being killed after that?
Ramp up period doesn't stop thread, setting Duration will stop(/kill) thread if reach duration time,
Each thread execute independently until it finishes his last loop,
So in your case each thread will end after ~0.6 seconds (0.2 second per request * 3 loops)
It is possible that the very first request that Jmeter sends will get the response from the server in just 0.2 seconds(200ms) - yes, it may be even less, the question is whether your application can respond in 200 ms or less
What happens to that thread from that moment? Will this thread being killed after that? - for particular your set up if there are no more Samplers to execute the thread will execute this HTTP Request sampler 2 more times and after that it will be asked to stop.
You can increase JMeter logging verbosity to whatever level of details you want and inspect jmeter.log file in order to get the idea regarding what's going on under the hood of JMeter. Basic details can be obtained without any configuration tweaks:
Related
I need to run a load test of 25 threads, what will be the most efficient configuration to use? (ramp-up period....). I ran the load test with the below configuration and some of the threads failed but pass if I just ran the script individually.
Your configuration will mean that:
JMeter start with 1 thread and add another thread each 4 seconds
Once started each thread will begin to execute Samplers upside down (or according to the logic controllers)
When the thread executes the last sampler it will be shut down
When the last thread executes the last sampler the test ends
Depending on the number of samplers and application response time you may or may not achieve 25 users concurrency, you might want to check the actual number of concurrent users using Active Threads Over Time listener
If you want to make sure to have 25 online users set "Loop Count" to Infinite and "Specify Thread Lifetime" duration to be more than your ramp-up period. See JMeter Test Results: Why the Actual Users Number is Lower than Expected article for more details.
With regards to the failures - we cannot state anything meaningful without seeing request and response details, make sure to save them using i.e. View Results Tree listener and inspect response body for the failed requests
I want to achieve the throughput 7.6 requests per second.
I am using bzm- Concurrency Thread Group with Feedback function and Throughput shaping timer as below. Please ignore the thread groups which are striked out. They are disabled and are not executed by Jmeter.
When I run the script from command line, it shows the logs as below
And in the log file, it mentions that:
In the Concurrency Thread Group, I have defined Target Concurrency with a Feedback function as ${__tstFeedback(tst-name,1,100,30)}
Here, 1 and 100 are starting threads and max allowed threads, 30 is how many spare threads to keep in thread pool.
My first question is:
Q1. Why in the command line logs it says that no free threads are available in the current thread group. As you can see from the command line, only 39 threads started. I have defined max allowed threads as 100. On the top of that 30 are kept in the thread pool so that Jmeter can use them if 100 threads are not enough. I also tried increasing the number of threads by passing ${__tstFeedback(tst-name,1,200,30)} , but still I get the same error.
Still why does it say in the logs that no free threads available and hence increase your number of threads?
Also, as you can see from the Summary report, Transaction Controller for Scenario 3 and Scenario 4 are not executed by Jmeter
Q2. What could be the reason that Scenario 3 and Scenario 4 are not executed by Jmeter?
Q1 the warning is being written in 6 milliseconds after test start when only 1 thread was running, do you really expect that 1 thread can conduct the load of 7.6 requests per second? I mean theoretically it's possible, if your application response time is below 130 ms, however I don't think it's applicable for your case, try starting with i.e. 30 threads and remove these ramp-up period and steps.
Q2 we don't know, most probably the reason is that your test doesn't run long enough so first thread isn't able to execute all samplers in scenarios 1 and 2 or there are some Logic Controllers which prevent these scenarios execution or there is a Flow Control Action sampler which doesn't allow the thread to go further, etc.
The answers are always in jmeter.log file, you might also want to increase the JMeter log level for the Throughput Shaping Timer by adding the next line to log4j2.xml file:
<Logger name="kg.apc.jmeter.timers.VariableThroughputTimer" level="debug" />
Im using JMeter for stress testing. Im sending requests in a continuous loop. Actually Latency / Elapsed time shows only 10 ms., but JMeter is not executing the next sampler for another 100 - 120 ms., which is resulting in a delay.
I really wonder if each sampler takes so much time for preparing to be executed. Also, generally pre and post processor dont get logged into results csv., so the sample elapsed time included their execution time as well?
Appreciate the help
Test Plan
TestPlan
Setup Thread Group
Thread Group 1
Random Variable
User Defined vars
Loop1
Http Request1
Header Manager
Post Processor (My Own, it really improved performance compared to BeanShell / JSR223)
Http Request2
Header Manager
Constant Time wait (50ms)
Loop2
Http Request1
Header Manager
Post Processor (My Own)
Http Request2
Header Manager
Constant Time wait (10ms)
Thread Group 2 #not used at the moment
Thread Group 3 #not used at the moment
Teardown Thread Group
In the Above plan., there is no sleep or anything between HTTP Request 1 & 2., still it is taking 115ms
Thought there is a wait after HTTP Request2 in each loop it is just 10 ms, here it is taking 125 ms.
Thanks,
Rao
Timers are not well understood by JMeter users because they have an odd behavior as stated by the documentation:
Note that timers are processed before each sampler in the scope in which they are found; if there are several timers in the same scope, all the timers will be processed before each sampler.
I suggest you to use the Test Action to simulate delays as its behavior is easier to understand. Define its duration as the delay you want to simulate and you are set.
I have Simple scenario:
Thread Group - One user sign in
- HTTP Sampler for Sign in
- Loop Controller - count as 10
- HTTP Sampler for check page
As per the logic, it is working fine for 1-time sign in, 10 times check the page.
But if I give the same with 10 Users sign in, 100 times from check page, it is not sending all the requests to the server.
It is sent only around 60 to 70 request for check page. other requests are not sent from the JMeter.
Server side CPU usage getting 100%, is it restricting the JMeter to send the request further?
Scheduler Enabled in Thread Group restricted the Test running time with the argument Duration.
Scheduler Configuration set for the duration of 600 seconds causing the test to stop before all the iterations completed, which are still running.
Removing Scheduler Configuration resolved the issue and all iterations ran.
Note: The issue is identified after long discussion in the chat with the user. so question may not contain all the details.
following are some of the configuration he did in Thread Group:
Duration field: ${__P(duration,600)}
Delay : ${__P{delay,0}}
removing them resolved the issue.
I am working on stress test, but my first sampler floods server with tons of requests with very little amount of time, so I want to make a delay between each thread using request.
Test structure:
Thread1 - Sampler1 (for example: access login form)
Delay (custom seconds)
Thread2 - Sampler1 (for example: access login form)
Delay (custom seconds)
ThreadN - Sampler1 (for example: access login form)
Delay (custom seconds)
Thread1 - Sampler2
Delay (custom seconds)
Thread2 - Sampler2
Delay (custom seconds)
<...>
Synchronizing Timer
All threads realeased with final sampler (this part works)
I tried to put timers as samplers parents or childs. Probably I am missing something, because non of the timers are working for me.
I've found similar problem solutions, but non of the worked for me:
JMeter - sharing a delay between requests across multiple ThreadGroups
Delays for each thread in Ultimate Thread Group
I would suggest using the stepping thread group via http://jmeter-plugins.org/wiki/SteppingThreadGroup/.
In the 'thread scheduling parameters' section, you'll note you're able to specify the maximum number of threads to run at peak, but you're also also to slowly instantiate threads as you need them.
Very plainly, the setup below says "When I run this test, I'm eventually going to want 100 threads, but when I first start the test, wait 15 seconds, then only start 10 threads. Then add another 10 threads every 120 seconds. Once we reach max threads, keep working for 180 seconds, then slowly peel off 5 threads every 15 seconds.
This should meet your need.
As per your Test Plan description, you can use 1 of the timers mentioned below:
Gaussian Random Timer
Constant Timer
Hope this will help..
Constant Timer would be best option as per your mentioned requirement.
You can use 'Ultimate Thread Group' instead of regular Thread Group. There is 'Initial Delay' in ultimate thread group which will help you to achieve your requirement.