3.6. Sequences

Sequences can be used in any template string loaded from the scenario configuration. They are typically used to customize messages in a way that each message sent is unique.

A Sequence only implements two methods. First, reset() to reset the Sequence to its initial state, and second publishNext() to publish the next value(s) in the row to the provided properties. The Sequences are used heavily by many threads. Therefore they must be thread-safe and handle the load smart.

A wrong example is the NumberSequence which has the publishNext() method synchronized. This makes a significant overhead to the PerfCake performance.

Much better example is the PrimitiveNumberSequence which uses AtomicLong internally.

Each sequence can publish more values at once, each having its own unique key prefixed with the value from the sequenceId parameter of the publishNext() method.