Router
Divides traffic between branches. Input and output.
How it works#
The Router takes each entity it is given and passes it to one of the components connected to its output. It stands for anything that decides where work goes next: a load balancer, a dispatcher, a traffic split between two versions of a service, a fork in a production line.
It is the one place a model divides traffic. A generator, a server and a delay each have a single output, so to send their entities to more than one component you put a router after them. That keeps the rule visible on the canvas, as a node with a policy you can read and change, instead of hidden in whichever component happened to have two lines leaving it.
A router takes no simulated time and holds nothing. An entity is passed on in the same instant it arrives, so a router adds nothing to the cycle time and never has a queue of its own.
A router is passive on its input and active on its output: it is fed like a queue, and it pushes onward like a generator. So it can follow a generator, a server, a delay or another router, and hand on to queues, delays or further routers — but a server cannot pull from it. To split work between servers, give each server its own queue and route to the queues.
The branch is chosen without looking at what is on the other end. If the queue on the chosen branch is full, the entity is refused, dropped and counted against the router. It is not offered to another branch.
With nothing connected to its output, entities reaching a router count as completed and leave the model.
Settings#
- Policydefault Round-robin
- The rule that picks a branch for each entity: Round-robin, Random or Weighted.
- Weights0 to 100 per branch — default 1
- Shown when the policy is Weighted. One weight for each branch, listed by the name of the component the branch leads to, with the share it works out to next to it.
Policies
- Round-robin
- Each branch in turn, so none is favoured. The split is exact: with three branches, every third entity goes to each.
- Random
- A branch chosen at random for every entity, each equally likely. The split is even on average, but any one branch can receive several entities in a row.
- Weighted
- A branch chosen at random, in proportion to its weight. Use it to send 90% of traffic one way and 10% another, or to model a load balancer that favours its larger instances.
Weights
Weights are relative, not percentages that must add up to 100. A branch receives its weight divided by the sum of all the weights: 3 and 1 give 75% and 25%, and so do 75 and 25. Every branch starts at 1, so a weighted router you have not touched splits evenly. A branch with a weight of 0 receives nothing.
A weight belongs to its connection. Connect the router first, then set the weights; a branch you add later starts at 1.
Both the policy and the weights can be changed while the simulation runs, so you can shift traffic from one branch to another and watch the queues behind them respond.
Statistics#
- Share of each branch — the percentage of the entities the router delivered that went to each branch, one line per branch over time. Under round-robin the lines sit flat at an even split; under the random policies they wander around their target and settle as the run goes on.
- Entity rate — entities passed on and entities dropped per second over time. Drops here mean a queue on one of the branches was full.
- After a batch run, the passed on and dropped rates and the share of each branch, each as a mean per run with a confidence interval.
The share counts only what a branch accepted. A branch that refuses much of what it is sent shows a smaller share than its weight — compare the two to see which branch is losing work.