How does multiple thread groups execute in jmeter - jmeter

Lets say we have 2 thread groups, one has 10 threads, another one has 30 threads. I have unchecked "run thread group consecutively". In table results, we see response time of second thread group is more than first threadgroup users.
When threadgroups are arranged other way, it shows reverse. So, whichever is second thread group, its user showing response time more than what is there in first thread group.

When you unchecked the "run thread group consecutively", then both the thread group runs in parallel. Now, based on the number of thread they will send the requests. In your scenario, 2nd thread group has created 30 threads and start sending the request. Now, based on,after how much time the response will come, it is listed in the view result. So, you thread group have more thread and may be getting response faster then thread 1. But, thread 1 is also going to be listed in the view results as shown below;-
Option is unchecked, so parallel running:-
So,in short, if "run thread group consecutively" option is unchecked, thread groups will run in parallel else sequential.
Option is checked, so sequential running:-
Hope this helps.

Only one explanation comes to my mind:
You're running your test in GUI mode
You're running it in GUI mode with Listeners enabled
If above assumptions are correct JMeter is simply lacking resources in order to kick off that many threads and given JMeter is not capable of sending requests fast enough you're getting "false negative" results as JMeter spends time in GC trying to free up some Heap space in order to be able to operate.
So:
Make sure to run your test in command-line non-GUI mode
Disable all the Listeners, they don't add any value, only consume valuable resources
Follow recommendations from the 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure in order to configure JMeter for maximum performance

Related

How to run threads in parallel

The stress test plan contains 5 threads, see below.
Lets consider a food booking app :
Thread 0 contains the prerequisites such as extracting the token which will be used by the remaining threads (1,2,3,4).
Thread 1 relates to the food menu.
Thread 2 relates to adding items to the menu and calculating the order price.
Thread 3 creates the order.
Thread 4 confirms the order.
Each thread requires the previous thread to be executed as it uses the response from the previous thread and I have been asked to run Thread 1,2,3,4 concurrently, but the fact is they cannot be run concurrently as
Thread 3 cannot be executed without actually executing Thread 2 and so on.
7.
Let me add a real-world use case:
A user is viewing the menu items
Concurrently, another user is confirming the order
Another user is adding items to the cart
Actually, all the operations are taking place concurrently, but no operation can be performed by skipping the previous threads.
How do I make changes to my script to accommodate such type of parallel stress testing?
Had to re-read your question a few times... I think what you are asking is can you run multiple "Thread Groups" ... the answer is yes, in your test plan you right-click and add multiple Thread Groups, each thread Group has its own user journey scripted.
As for dependencies between Thread Groups there are options for sharing variables. but you would likely need to work out your logic and write a little bit of groovy to ensure that the data flows correctly.
You could also look at "How to Use the Inter-Thread Communication Plugin in JMeter" on the BlazeMeter website: https://www.blazemeter.com/blog/how-to-use-the-inter-thread-communication-plugin-in-jmeter
Update: After Christian's formatting of the question, it appears that "threads 0-4" are describing a user journey. for example; user logs in, clicks menu, adds item x, goes to checkout etc.
This would be recorded in one Thread Group. Each call made would provide a server response that could then be parameterised and correlated, ensuring data is passed appropriately. The "concurrency" would come from ramping up multiple users "Threads".
For example; here in this screenshot, I have added a Thread Group that has 4 HTTP Samplers (the user journey). The Thread Group is then set to run 10 users, ramping up in 5 minutes (300 seconds), and runs for a duration of 3600 seconds (aka 1 hour).

What jmeter configuration I should use when running load test of 25 threads

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

Number of execution samples

i am running a simple test with 10 users for 5 mins. my test has a single thread and different transactions within it. By the end of the test, there is a different number of samples for each transaction. Is there a way or a setting so that we don't start any new thread when the test is finishing, i tried ultimate thread group plugin with ramp down , hoping to see same samples for all requests but it didn't happen. Not sure if that is even possible.
Each JMeter thread (virtual user) executes Samplers upside down (or according to the Logic Controllers)
When you're defining test duration it might be the case that some virtual users are somewhere in the "middle" of the Samplers and they stop when they receive shutdown signal.
It means that the very first sampler will be executed with 100% of users and for further samplers the chance of getting executed becomes lower and lower.
The only way to have the same number of Sample Results for all Samplers is using normal JMeter Thread Group and providing fixed amount of loops.
Given above setup you will have strictly 80 executions of each and every Sampler in the Test Plan
More information: Getting Started with JMeter - A Basic Tutorial

Start JMeter thread after another thread

I want to run a thread x times. The thread group contains three samplers and because I dont want them to be mixed up in the result windows I only want to start the next thread when another is finished. I don't want to use a Ramp-Up Period because a thread could take 1 to 20 seconds.
You could use 3 thread groups and module controller (to referencd in the 2 other thread groups the elements in the first one to avoid copy ) and check on test plan the option:
Run Thread Group sequentially
Your use case is not very clear, however if you need to limit JMeter to X concurrent threads only the most obvious choice would be going for the Concurrency Thread Group
As per Advanced Load Testing Scenarios with JMeter Part 4 - Stepping Thread Group and Concurrency Thread Group article:
The Concurrency Thread Group provides a better simulation of user behaviour because it lets you control the length of your test more easily, and it creates replacement threads in case a thread finishes in the middle of the process.
You can install Concurrency Thread Group as a part of Custom Threads Group bundle using JMeter Plugins Manager
Regarding your three listeners bit, I would recommend reconsidering this approach as per JMeter Best Practices you should not be using any listeners, instead of it you need to run JMeter in non-GUI mode and use -l command-line argument to specify the results file name. Once your test is finished you can open the .jtl results file with a listener of your choice or generate a reporting dashboard from it.
You can use "jp#gc - Ultimate Thread Group". The Ultimate Thread Group provides flexible thread scheduling to your test scenario. It allows us to create a scheduled thread with advanced configuration. Start Threads Count, Initial Delay, Startup Time and Hold Load Time can be defined separately for each record.
You can define tasks to run consecutively.
This platform support flexible thread scheduling. You can read detailed wiki docs about the ultimate thread group.
Link: Loadium.com/wiki/ultimate thread

Jmeter thread groups

I have entered 500 to be the number of thread group and ramp up time to be 120 seconds but when the report is generated,the virtual users count is only 15 or in composite graph-active threads over time is raised to near about 12. So I am bit confuse active threads counts. Because the data(threads) or numbers that I filled in test plan before test is different and after result is different. What about scaled values in graph?and x10?Something related to threads?
Each JMeter thread representing a virtual user after initialization starts executing samplers upside down (or according to the Logic Controllers).
If thread doesn't have more samplers to execute and no more loops to iterate it's being shut down. It looks just like your case. See Max Users is Lower than Expected article for more detailed explanation and workaround.
Usually people set Loop Count to "Forever" and use Runtime Controller to so test could finish in designed time. Another option is using i.e. Ultimate Thread Group available via JMeter Plugins which provides convenient way of defining a load scenario.

Resources