Generator

The source of entities. Output only.

How it works#

The Generator is where traffic enters your model. It creates entities one after another and pushes each into the component it is connected to. Use it for incoming HTTP requests, arriving customers, sensor readings, messages landing on a topic — any stream of work your system does not control.

Unless you choose otherwise, arrivals are random rather than evenly spaced. Each gap is drawn from an exponential distribution, so load naturally clusters into bursts and lulls around the average you configure. This matters: a system sized for the average arrival rate and fed perfectly even traffic looks comfortable, while the same system fed realistic bursty traffic queues up. The Distribution setting makes the gaps steadier or more erratic. The generator schedules the next arrival as soon as one is released, so its pace never depends on how quickly the rest of the model keeps up.

If the queue it feeds is full, the entity waits outside it for up to the Wait Timeout, while the generator keeps producing on schedule. If no room appears in that time it leaves the model as dropped — which is precisely the signal that the model cannot absorb the load being offered to it.

A generator must have an outgoing connection; the simulation will not start while one is left dangling. It has one: to send its entities to several components, connect it to a Router.

Settings#

Arrival Rateentities per second — default 3
The mean rate λ at which entities are created. The mean time between arrivals is 1/λ, whichever distribution is chosen. With a traffic profile it is the rate the profile starts from.
Distributiondefault Exponential
How the times between arrivals are spread around their mean: Exponential, Deterministic, Uniform, Erlang or Lognormal. Exponential makes the arrival process Poisson — the standard assumption for independent, uncoordinated traffic.
Spreadshare of the mean, 0 to 1 — default 0.5
Shown when the distribution is Uniform. How far either side of the mean a time between arrivals can fall.
Stagesexponential stages, 1 to 100 — default 2
Shown when the distribution is Erlang. More stages, less variation.
Variabilitystandard deviation over the mean, 0.1 to 10 — default 1
Shown when the distribution is Lognormal. The coefficient of variation of the times between arrivals.
Traffic Profilestages of a duration in seconds and a target rate per second — default none
Makes the arrival rate change over the run instead of staying constant. Each stage has a duration (0 to 86400 seconds) and a target rate (0 to 100000 per second). See Traffic profile below.
Wait Timeoutseconds, 0 to 3600 — default 1
How long an entity waits outside a full queue for room before it is dropped. 0 means no waiting: the entity is dropped at once.

The arrival rate can be changed while the simulation runs, so you can raise it and watch queues and drops respond without restarting. So can Spread, Stages and Variability; the distribution and the traffic profile are fixed for the length of a run. Distributions describes each one and what its shape setting does. Wait Timeout is set in the editor, before a run, and applies when the queue's Overflow Policy is NO_OVERRIDE; Full queues and waiting covers it in full.

Traffic profile#

Real traffic is rarely constant: it ramps up in the morning, spikes when a campaign lands and falls away at night. A traffic profile describes that shape. It is a start rate — the Arrival Rate — followed by an ordered list of stages, the way the ramping arrival rate executor of k6 describes it. Requests arrive at the profile's rate whatever the rest of the model does, so a system that falls behind sees the load keep coming.

Each stage has a duration and a target rate. During a stage the rate moves in a straight line from where the previous stage ended to its target. A stage of 0 seconds is a jump. After the last stage the rate holds at its target. A target of 0 pauses arrivals until a later stage raises the rate again; to hold at zero rather than ramp down to it, put a jump to 0 first. Times are simulated seconds counted from the start of the run, warm-up included. With no stages the generator sends at its Arrival Rate throughout.

The profile sets the mean rate over time and the Distribution still sets the shape of the gaps, so every distribution works with every profile. Adding the first stage switches the distribution to Deterministic, which spaces requests evenly as k6 does; change it back to Exponential for random, Poisson arrivals that follow the profile.

Instead of typing stages, replace them with a preset and adjust from there. A preset only fills in stages, scaled from the current Arrival Rate:

Ramp
Climb steadily to 4 times the rate over 5 minutes.
Step
Hold each of 1, 2, 3 and 4 times the rate for a minute, jumping between them.
Spike
A quiet minute, a surge to 10 times the rate for 30 seconds, then quiet again.
Wave
Two swings between the rate and 3 times the rate, a minute each way.
Soak
Hold the rate for an hour.
Stress
Climb to 2, 3 and 4 times the rate, holding each for 5 minutes, then come back.

The editor draws the rate over time as you change the stages. The profile is fixed for the length of a run and is shown read-only while one is running. Every replication of a batch follows the same profile; only the random draws differ. It is saved with the model. The model library has an example, Connection pool under a spike, in which a surge of orders drains a pool of connections.

Statistics#

Entity rate — completed and dropped entities per second, plotted together over time. Completed is the traffic that actually made it into the model; dropped is what the model turned away. A dropped line lifting off zero is the earliest sign that the system downstream is undersized for the offered load, and it usually appears well before anything else looks alarming.

After a batch run, the generator reports the same two rates as a mean per run with a confidence interval.

Arrivals Against Profile — a chart you can switch on during a live run: arrivals per second drawn against the rate the traffic profile expects, so you can see the offered load follow its shape. An Advanced batch run draws the same comparison across the whole run, as the mean of its replications.

Per stage — after a batch run, a table lists the arrivals the profile expects in each stage next to the mean arrived and dropped per run, with confidence intervals, plus a row for the time after the last stage. A request counts in the stage it arrived in, however long it took to be dealt with, and one that arrives exactly on a boundary counts in the stage that follows. Stages inside the warm-up or beyond the end of the run are left out. Dropped counts what the generator itself saw refused or timed out; failures further downstream are counted where they happen.