Random Messaging Network

Generated by GenServerVirtualTime โ€ข Mermaid Flowchart

๐Ÿ“ˆ Simulation Summary

Virtual Time
2000ms
Real Time
50ms
Speedup
40.0x
Termination
โฑ Max Time

๐Ÿ“Š Actor Topology

flowchart TB actor1("actor1
๐Ÿ“ค Sent: 30
๐Ÿ“ฅ Recv: 44") actor2("actor2
๐Ÿ“ค Sent: 48
๐Ÿ“ฅ Recv: 41") actor0("actor0
๐Ÿ“ค Sent: 42
๐Ÿ“ฅ Recv: 42") actor3("actor3
๐Ÿ“ค Sent: 60
๐Ÿ“ฅ Recv: 39") actor4("actor4
๐Ÿ“ค Sent: 60
๐Ÿ“ฅ Recv: 39") actor5("actor5
๐Ÿ“ค Sent: 24
๐Ÿ“ฅ Recv: 45") actor6("actor6
๐Ÿ“ค Sent: 30
๐Ÿ“ฅ Recv: 44") actor1 -->|:hi
every 347ms| actor0 actor2 -->|:hi
every 236ms| actor5 actor6 -->|:hi
every 358ms| actor0 actor5 -->|:hi
every 441ms| actor2 actor4 -->|:hi
every 197ms| actor6 actor5 -->|:hi
every 441ms| actor0 actor0 -->|:hi
every 271ms| actor2 actor2 -->|:hi
every 236ms| actor1 actor4 -->|:hi
every 197ms| actor3 actor4 -->|:hi
every 197ms| actor0 actor6 -->|:hi
every 358ms| actor3 actor1 -->|:hi
every 347ms| actor4 actor1 -->|:hi
every 347ms| actor3 actor5 -->|:hi
every 441ms| actor3 actor5 -->|:hi
every 441ms| actor1 actor1 -->|:hi
every 347ms| actor6 actor6 -->|:hi
every 358ms| actor5 actor3 -->|:hi
every 191ms| actor6 actor2 -->|:hi
every 236ms| actor4 actor4 -->|:hi
every 197ms| actor5 actor2 -->|:hi
every 236ms| actor6 actor3 -->|:hi
every 191ms| actor1 actor4 -->|:hi
every 197ms| actor1 actor2 -->|:hi
every 236ms| actor0 actor0 -->|:hi
every 271ms| actor6 actor5 -->|:hi
every 441ms| actor4 actor3 -->|:hi
every 191ms| actor0 actor0 -->|:hi
every 271ms| actor1 actor1 -->|:hi
every 347ms| actor5 actor0 -->|:hi
every 271ms| actor5 actor0 -->|:hi
every 271ms| actor4 actor1 -->|:hi
every 347ms| actor2 actor3 -->|:hi
every 191ms| actor2 actor6 -->|:hi
every 358ms| actor1 actor3 -->|:hi
every 191ms| actor4 actor2 -->|:hi
every 236ms| actor3 actor3 -->|:hi
every 191ms| actor5 actor6 -->|:hi
every 358ms| actor2 actor6 -->|:hi
every 358ms| actor4 actor5 -->|:hi
every 441ms| actor6 actor4 -->|:hi
every 197ms| actor2 actor0 -->|:hi
every 271ms| actor3 style actor1 fill:#fff3e0,stroke:#f57c00,stroke-width:3px style actor2 fill:#fff3e0,stroke:#f57c00,stroke-width:3px style actor0 fill:#fff3e0,stroke:#f57c00,stroke-width:3px style actor3 fill:#fff3e0,stroke:#f57c00,stroke-width:3px style actor4 fill:#fff3e0,stroke:#f57c00,stroke-width:3px style actor5 fill:#fff3e0,stroke:#f57c00,stroke-width:3px style actor6 fill:#fff3e0,stroke:#f57c00,stroke-width:3px

Node Shapes (Actor Type)

flowchart TD legend_processor("Processor
(send & receive)") style legend_processor fill:#ffffff,stroke:#666666,stroke-width:2px

Node Colors (Activity Level)

flowchart LR activity_0["๐ŸŸ  High Activity (>50 msgs)"] style activity_0 fill:#fff3e0,stroke:#f57c00,stroke-width:3px

๐Ÿ“‰ Detailed Statistics

Actor Sent Received Send Rate Receive Rate Activity
actor1 30 44 15.0 msg/s 22.0 msg/s 74 total
actor2 48 41 24.0 msg/s 20.5 msg/s 89 total
actor0 42 42 21.0 msg/s 21.0 msg/s 84 total
actor3 60 39 30.0 msg/s 19.5 msg/s 99 total
actor4 60 39 30.0 msg/s 19.5 msg/s 99 total
actor5 24 45 12.0 msg/s 22.5 msg/s 69 total
actor6 30 44 15.0 msg/s 22.0 msg/s 74 total
Summary: Total messages: 588 โ€ข Duration: 2000ms โ€ข Actors: 7

๐Ÿ’ป Model Source Code

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

# Create 7 actors that all know each other, sending random :hi messages
# Fixed random seed for reproducible results
:rand.seed(:exs1024, {42, 123, 456})

# Generate random delays for each actor (100-500ms)
random_delays = Enum.map(1..7, fn _ -> :rand.uniform(400) + 100 end)

# All actors know each other (full mesh topology)
all_targets = [:actor0, :actor1, :actor2, :actor3, :actor4, :actor5, :actor6]

simulation =
  ActorSimulation.new()
  |> ActorSimulation.add_actor(:actor0,
    send_pattern: {:periodic, Enum.at(random_delays, 0), :hi},
    targets: all_targets -- [:actor0]
  )
  |> ActorSimulation.add_actor(:actor1,
    send_pattern: {:periodic, Enum.at(random_delays, 1), :hi},
    targets: all_targets -- [:actor1]
  )
  |> ActorSimulation.add_actor(:actor2,
    send_pattern: {:periodic, Enum.at(random_delays, 2), :hi},
    targets: all_targets -- [:actor2]
  )
  |> ActorSimulation.add_actor(:actor3,
    send_pattern: {:periodic, Enum.at(random_delays, 3), :hi},
    targets: all_targets -- [:actor3]
  )
  |> ActorSimulation.add_actor(:actor4,
    send_pattern: {:periodic, Enum.at(random_delays, 4), :hi},
    targets: all_targets -- [:actor4]
  )
  |> ActorSimulation.add_actor(:actor5,
    send_pattern: {:periodic, Enum.at(random_delays, 5), :hi},
    targets: all_targets -- [:actor5]
  )
  |> ActorSimulation.add_actor(:actor6,
    send_pattern: {:periodic, Enum.at(random_delays, 6), :hi},
    targets: all_targets -- [:actor6]
  )
  |> ActorSimulation.run(duration: 2000)

# Generate the report
html = MermaidReportGenerator.generate_report(simulation,
  title: "Random Messaging Network",
  layout: "TB",
  model_source: model_source
)