# pragmaticflow/nbomber architecture

> Architecture diagram of the GitHub repository pragmaticflow/nbomber, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pragmaticflow/nbomber
- Repository: https://github.com/pragmaticflow/nbomber

## Overview

##### Main Components Identification

The system should be divided into these major components:

a. Core Framework Components:
- Test Runner Engine
- Scenario Management
- Load Simulation Engine
- Statistics & Metrics Collection
- Reporting System
- Plugin System

b. Integration Components:
- Protocol Adapters (HTTP, WebSockets, MQTT, etc.)
- Database Connectors (Redis, SQLite, etc.)
- External Monitoring Systems (InfluxDB, TimescaleDB, Grafana)

**┌─ User Interface Layer ─────────────────────┐**
- CLI Interface                            │
- xUnit/NUnit Test Runners                 │
- NBomber Studio (Real-time Monitoring)    │
- ┬─┘

**┌─ Core Framework Layer ──────────────────┼─┐**
- ┌─ Scenario Management ─┐ ┌─ Test Host ─┴┐ │
- Scenario Builder    │ │ - Runner     │ │
- Step Management    │ │ - Scheduler  │ │
- Context Handling   │ │ - Plugins    │ │
- ┬─┘ └─────────────┘ │

- ┌─ Load Simulation ──┴─┐ ┌─ Statistics ─┐ │
- Constant Load      │ │ - Metrics    │ │
- Step Load         │ │ - Analysis   │ │
- Custom Patterns   │ │ - Storage    │ │
- ┬─┘ └──────┬──────┘ │
- ┼───────────┼────────┘

**┌─ Integration Layer ──┼───────────┼────────┐**
- ┌─ Protocol Adapters┐│ ┌─ Reporting ┐    │
- HTTP            ││ │ - HTML      │    │
- WebSockets      ││ │ - CSV       │    │
- MQTT            ││ │ - JSON      │    │
- ┘│ └────────────┘    │

- ┌─ External Systems ┴┐ ┌─ Data Feeds ┐   │
- InfluxDB         │ │ - CSV       │   │
- TimescaleDB      │ │ - JSON      │   │
- Grafana          │ │ - Custom    │   │
- ┘ └────────────┘   │
- ┘

##### Component Relationships

- Data flow between components
- Dependencies
- Integration points
- Plugin extension points

##### Important Details

- Cluster mode capabilities
- Plugin architecture points
- Data feed integration points
- Reporting sink connections
- Load simulation patterns
- Metrics collection flow

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI["User Interface Layer"]
        CLI["CLI Interface"]
        TestRunners["xUnit/NUnit Test Runners"]
        Studio["NBomber Studio"]
    end

    subgraph Core["Core Framework Layer"]
        subgraph ScenarioMgmt["Scenario Management"]
            ScenBuilder["Scenario Builder"]:::core
            StepMgmt["Step Management"]:::core
            Context["Context Handling"]:::core
        end

        subgraph TestHost["Test Host"]
            Runner["Runner"]:::core
            Scheduler["Scheduler"]:::core
            Plugins["Plugin System"]:::core
        end

        subgraph LoadSim["Load Simulation"]
            ConstLoad["Constant Load"]:::core
            StepLoad["Step Load"]:::core
            CustomPatterns["Custom Patterns"]:::core
        end

        subgraph Stats["Statistics"]
            Metrics["Metrics Collection"]:::core
            Analysis["Analysis"]:::core
            Storage["Storage"]:::core
        end

        ConfigMgmt["Configuration Management"]:::core
        ActorSystem["Scenario Actor System"]:::core
    end

    subgraph Integration["Integration Layer"]
        subgraph Protocols["Protocol Adapters"]
            HTTP["HTTP"]:::integration
            WebSockets["WebSockets"]:::integration
            MQTT["MQTT"]:::integration
        end

        subgraph Reporting["Reporting"]
            HTML["HTML Reports"]:::integration
            CSV["CSV Reports"]:::integration
            JSON["JSON Reports"]:::integration
        end

        subgraph External["External Systems"]
            InfluxDB["InfluxDB"]:::external
            TimescaleDB["TimescaleDB"]:::external
            Grafana["Grafana"]:::external
        end
    end

    %% Relationships
    UI --> Core
    ScenarioMgmt --> TestHost
    TestHost --> LoadSim
    LoadSim --> Stats
    Stats --> Reporting
    TestHost --> Protocols
    Stats --> External
    ConfigMgmt --> TestHost
    ActorSystem --> LoadSim

    %% Click Events
    click ScenBuilder "https://github.com/PragmaticFlow/NBomber/blob/dev/src/NBomber/Domain/Scenario.fs"
    click LoadSim "https://github.com/PragmaticFlow/NBomber/blob/dev/src/NBomber/Domain/LoadSimulation.fs"
    click Runner "https://github.com/PragmaticFlow/NBomber/blob/dev/src/NBomber/DomainServices/TestHost/TestHost.fs"
    click Metrics "https://github.com/PragmaticFlow/NBomber/blob/dev/src/NBomber/Domain/Stats/Statistics.fs"
    click Reporting "https://github.com/PragmaticFlow/NBomber/tree/dev/src/NBomber/DomainServices/Reports"
    click Plugins "https://github.com/PragmaticFlow/NBomber/tree/dev/src/NBomber/Plugins"
    click HTTP "https://github.com/PragmaticFlow/NBomber/tree/dev/examples/Demo/HTTP"
    click WebSockets "https://github.com/PragmaticFlow/NBomber/tree/dev/examples/Demo/WebSockets"
    click MQTT "https://github.com/PragmaticFlow/NBomber/tree/dev/examples/Demo/MQTT"
    click External "https://github.com/PragmaticFlow/NBomber/tree/dev/examples/Demo/Features/RealtimeReporting"
    click ActorSystem "https://github.com/PragmaticFlow/NBomber/blob/dev/src/NBomber/Domain/Concurrency/ScenarioActor.fs"
    click ConfigMgmt "https://github.com/PragmaticFlow/NBomber/blob/dev/src/NBomber/Configuration.fs"

    %% Styles
    classDef core fill:#2374ab
    classDef integration fill:#47a025
    classDef external fill:#ff7f50
    
    %% Legend
    subgraph Legend
        CoreComp["Core Component"]:::core
        IntComp["Integration Component"]:::integration
        ExtComp["External System"]:::external
    end
```
