Introduction

When you run your action queue for a long period of time, it happens that some threads are quicker than others and over a period of time you see that the number of running threads is going down. Here is an example graph:

In order to avoid this, you can specify that you want to have each iteration of all threads to start at the same moment.
This means that the quicker threads will wait for slower ones to finish the current iteration and then, they will together start the next iteration.



Synchronizing the iterations

You need to use the setUseSynchronizedIterations method:

AllAtOncePattern threadingPattern = new AllAtOncePattern( 2, true, 10, 2000 );

// synchronize the iterations
threadingPattern.setUseSynchronizedIterations( true );

loader.setThreadingPattern( threadingPattern );



The result

As you can see the user activity has changed significantly:

No matter how many iterations will be completed and how many threads will run, they will always start together on each iteration.

Only AllAtOncePattern and FixedDurationAllAtOncePattern support this feature



Back to parent page

Go to Table of Contents