I have load testing scenario where test-plan has multiple thread-group and each thread-group has different type of HTTP request and this group is designed to executed in sequence .
Below is scenario I'm testing -
Test-Plan
+---Thread-Group(Register-Request)
+---Thread-Group(Container-Request)
+---Thread-Group(Subscription-Request)
+---Thread-Group(Data-Request)
+---Thread-Group(Deregister-Request)
Load testing has to follow the defined sequence. Each user-thread reads thread specific values from CSV file and during testing, JMeter output shows that:
User-threads don't move from Thread-Group(Register-Request) to Thread-Group(Container-Request) until all user threads have completed execution which looks odd to me.
Any idea what could the reason of this behaviour ?
User threads don't "move" from one Thread Group to another Thread Group, each Thread Group has its own pool of virtual users and they're not connected by any means.
So if you want each user to execute some actions (Register-Request, Container-Request, etc.) sequentially - you need to put the relevant Samplers under the same Thread Group.
If your workload model is more complex and i.e. you need to run different scenarios with different throughputs and maintain user session across Thread Groups at the same time - you can take a look at i.e. Using JMeter Variables With Multiple Thread Groups article Inter-Thread Communication Plugin or
Related
Scenario is we are generating token during execution which would further be used in other threadgroup.
Like:
In first thread group, tokens will be generated for 100 users.
In second thread group, 50 users will utilize the tokens.
In third thread group, next 50 users will utilize the tokens.
Query is:
1. How do we save tokens that is generated during run time?
2. How to use first 50 tokens on second thread group and rest other 50 on third thread group?
If you need to use a Token generated by a request in following requests then use 1 Thread Group and not many.
Threads in different ThreadGroup have absolutely no relation and are considered as different users, so although you may use elements like InterThreadCommunication to do that, just DON'T.
If you use same thread group then it's just a matter of using the correct extractor to generate variables and then use them using ${varName}.
You can transfer a value between Thread Groups by converting it into a JMeter Property. According to the documentation:
Properties are not the same as variables. Variables are local to a thread; properties are common to all threads, and need to be referenced using the __P or __property function.
So if you need to transfer something from one thread group into another:
Convert the value into a JMeter Property using __setProperty() function like:
${__setProperty(foo,bar,)}
Once done the value can be accessed usine __P() function like
${__P(foo,)}
Demo:
If the value is different for different threads - you can combine the above approach with __threadNum() or __counter() functions in order to use current virtual user number or next incremented number as a prefix or a postfix for the function.
Per the documentation:
ON COMMIT DROP: The temporary table will be dropped at the end of the current transaction block.
However, temporary tables are unique per session, not per thread: see here
My question:
If a temp table is marked WITH ON COMMIT DROP, how will PG handle multiple threads accessing that table as regards the fact any thread could commit, but the table couldn't be dropped as it's in use by other threads.
Edit:
AFAIK, multiple transactions can run within one session. If this is the case, more than one transaction could access a function that has a temp table, hence my question.
Postgres (server) knows nothing about client threads. It sees a session as a consecutive series of commands grouped in transactions. From the server's point of view concurrency inside a session is impossible.
A client application may be multi-threaded and threads can use the same connection. An application developer is responsible for ensuring that threads do not compete with each other for access to server resources. From the documentation:
One thread restriction is that no two threads attempt to manipulate the same PGconn object at the same time. In particular, you cannot issue concurrent commands from different threads through the same connection object. (If you need to run concurrent commands, use multiple connections.)
I need two users on web page both have different actions and login so I am using two threads (Login--action--Logout)
now I want user2 to start after user1 has completed 100 requests and user1 is still continuing 101,102,.....
how do I do this?
I think I cannot use delays as sometime 100 requests may take 100 sec or 90 sec etc.
is there any way to start another thread in between the running of present thread
If you're using two different users with two sets of actions that should be done at two different times, it sounds to me like you want to use two different Thread Groups. Make sure to use Run Thread Group Consecutively.
I have a few database IO operations I would like to run concurrently. In my case it would be best to use a BalancingPool Router.
The docs say if blocking operations are to occur in the workers then one should use a thread-pool-executor rather than the default fork-join-dispatcher.
I did not want to configure it in the Akka conf file so I think this would be the way to do it in code:
val router = context.actorOf(BalancingPool(5).withDispatcher("my-pinned-dispatcher").props(Props[History]), "HistoryBalancingRouter")
But the docs say for a PinnedDispatcher:
This dispatcher dedicates a unique thread for each actor using it;
i.e. each actor will have its own thread pool with only one thread in
the pool.
Mailboxes: Any, creates one per Actor
Whereas for the BalancingPool it says workers share a single mailbox:
The BalancingPool automatically uses a special BalancingDispatcher for
its routees - disregarding any dispatcher that is set on the the
routee Props object. This is needed in order to implement the
balancing semantics via sharing the same mailbox by all the routees.
While it is not possible to change the dispatcher used by the routees,
it is possible to fine tune the used executor. By default the
fork-join-dispatcher is used and can be configured as explained in
Dispatchers. In situations where the routees are expected to perform
blocking operations it may be useful to replace it with a
thread-pool-executor hinting the number of allocated threads
explicitly
So what is actually happening with mailboxes and threads here?
Is my example a sane way to implement a BalancingPool using a thread-pool-executor?
The BalancingPool always works with a BalancingDispatcher, it will simply refuse your PinnedDispatcher setting. The reason is exactly that the BalancingDispatcher allows actors to share a common mailbox (for performance) which other Dispatchers do not support.
Please note that several of the Dispatchers allow you to configure the Executor that they will use inside. By default, for BalancingPool it is the fork-join-executor (the docs incorrectly say "fork-join-dispatcher") but you can change it to use a thread-pool-executor. An example dispatcher configuration is here: http://doc.akka.io/docs/akka/2.3.13/scala/dispatchers.html#Setting_the_dispatcher_for_an_Actor you just need to change the executor type
So to explain my situation:
I have a JMeter test plan that runs some test groups constantly in a loop. In addition to this I need to have multiple sampler requests go through together each minute (to simulate spiked usages). I can't set a constant timer to delay each of these because some may finish up quicker than others and they won't be in sync.
Is there a way to make multiple test groups send a request every minute the test is running?
OR
Is there a way to put all these samplers in 1 thread group and make them all run concurrently?
As far as I'm able to understand your use case, you need 2 Thread Groups.
First Thread Group which is SOAP Sampler A
Second Thread Group which is SOAP Sampler B
Then you need to set different variables for both thread groups to make them behave according to your use case and implement spikes you need.
Important: make sure that "Run Thread Groups consecutively" under your test plan is UNCHECKED elsewise you'll be having SOAP Sampler B running after SOAP Sampler A, not in the same time.
Lets consider your scenario is,
5 Users hitting 5 URLs(samplers) simultaneously.
So what you need to do is, in your Test Plan, add 5 Thread Groups. In each Thread Group configure the number of Threads to 5 and Ramp Up to 0.
Now, add one HTTP Request sampler in each Thread Group. Configure each sampler according to the URL you want to test.
Add Listener(s) to your Test Plan. Save the Test Plan and Run your test.
Make sure you haven't selected the "Run Thread Groups consecutively" in the Test Plan.