Load-Balanced Workers

Generated by GenServerVirtualTime โ€ข Mermaid Flowchart

๐Ÿ“ˆ Simulation Summary

Virtual Time
1000ms
Real Time
5ms
Speedup
200.0x
Termination
โฑ Max Time

๐Ÿ“Š Actor Topology

flowchart TB load_balancer(["load_balancer
๐Ÿ“ค Sent: 45
๐Ÿ“ฅ Recv: 0"]) worker1("worker1
๐Ÿ“ค Sent: 15
๐Ÿ“ฅ Recv: 15") worker2("worker2
๐Ÿ“ค Sent: 15
๐Ÿ“ฅ Recv: 15") worker3("worker3
๐Ÿ“ค Sent: 15
๐Ÿ“ฅ Recv: 15") result_collector["result_collector
๐Ÿ“ค Sent: 0
๐Ÿ“ฅ Recv: 45"] load_balancer -->|:work
3 per 200ms| worker1 load_balancer -->|:work
3 per 200ms| worker2 load_balancer -->|:work
3 per 200ms| worker3 worker1 -->|:result
15/s| result_collector worker2 -->|:result
15/s| result_collector worker3 -->|:result
15/s| result_collector style load_balancer fill:#e8f5e9,stroke:#388e3c style worker1 fill:#e8f5e9,stroke:#388e3c style worker2 fill:#e8f5e9,stroke:#388e3c style worker3 fill:#e8f5e9,stroke:#388e3c style result_collector fill:#e8f5e9,stroke:#388e3c

Node Shapes (Actor Type)

flowchart TD legend_source(["Source
(sends only)"]) legend_sink["Sink
(receives only)"] style legend_source fill:#ffffff,stroke:#666666,stroke-width:2px style legend_sink fill:#ffffff,stroke:#666666,stroke-width:2px

Node Colors (Activity Level)

flowchart LR activity_0["๐ŸŸข Medium Activity (10-50 msgs)"] style activity_0 fill:#e8f5e9,stroke:#388e3c

๐Ÿ“‰ Detailed Statistics

Actor Sent Received Send Rate Receive Rate Activity
load_balancer 45 0 45.0 msg/s 0.0 msg/s 45 total
worker1 15 15 15.0 msg/s 15.0 msg/s 30 total
worker2 15 15 15.0 msg/s 15.0 msg/s 30 total
worker3 15 15 15.0 msg/s 15.0 msg/s 30 total
result_collector 0 45 0.0 msg/s 45.0 msg/s 45 total
Summary: Total messages: 180 โ€ข Duration: 1000ms โ€ข Actors: 5

๐Ÿ’ป Model Source Code

This is the Elixir code that defines the actor simulation model:

simulation =
  ActorSimulation.new(trace: true)
  |> ActorSimulation.add_actor(:load_balancer,
    send_pattern: {:burst, 3, 200, :work},
    targets: [:worker1, :worker2, :worker3]
  )
  |> ActorSimulation.add_actor(:worker1,
    on_match: [
      {:work, fn state -> {:send, [{:result_collector, :result}], state} end}
    ]
  )
  |> ActorSimulation.add_actor(:worker2,
    on_match: [
      {:work, fn state -> {:send, [{:result_collector, :result}], state} end}
    ]
  )
  |> ActorSimulation.add_actor(:worker3,
    on_match: [
      {:work, fn state -> {:send, [{:result_collector, :result}], state} end}
    ]
  )
  |> ActorSimulation.add_actor(:result_collector)
  |> ActorSimulation.run(duration: 1000)