# burden-load/burden architecture

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

- Interactive diagram: https://gitdiagram.com/burden-load/burden
- Repository: https://github.com/burden-load/burden

## Overview

##### Project Type and Purpose
- Burden is a CLI-based load testing tool written in Go, designed to simulate HTTP requests to a specific URL or to process an API collection file.
- The tool measures performance metrics such as throughput, response time, latency, errors, and more.
- Its main purpose is performance evaluation under simulated concurrent user loads.

##### File Structure
- Top-Level Directories and Files:
- cmd/main.go: The entry point of the CLI application.
- internal/: Contains sub-packages that encapsulate the core functionality.
∙ internal/config: Responsible for managing configuration (loading and validating parameters).
∙ internal/loader: Handles loading of the collection file (if provided) and possibly other inputs.
∙ internal/metrics: Manages the collection and calculation of performance metrics.
∙ internal/tester: Implements the core load testing logic, simulating user requests.
- pkg/model: Contains the data models (like request definitions) used across the application.
- Dockerfile: Indicates that the application can be containerized.
- Additional directories (examples, assets, tests) provide usage scenarios, supporting assets, and tests to ensure functionality.
- CI/CD and GitHub workflows are present, which shows how testing and release activities are automated.

a. Core Components:
- Command-Line Interface (CLI): Represented by cmd/main.go, it accepts user parameters (flags such as --url, --collection, --users, etc.) and kicks off testing.
- Configuration Module: Under internal/config, it handles parsing command-line arguments and possibly configuration files.
- Loader Module: Part of internal/loader, it handles importing and parsing the collection file (if the user opts for that).
- Tester Module: Found under internal/tester, this is the engine that simulates load by managing concurrent request execution.
- Metrics Module: Located in internal/metrics, it collects and calculates key performance metrics such as throughput and latency.
- Data Models: In pkg/model; these define the structure for request information and potentially other data that flows among modules.
b. Data Flow and Interactions:
- Start at the CLI: User inputs are parsed, and configuration data is created.
- The configuration is passed to both the Loader and the Tester:
∙ If a collection file is specified, the Loader reads and converts it into structured data models.
∙ Tester receives configuration and collection data to simulate load.
- The Tester module orchestrates simulated requests and interacts with the Metrics module, sending performance data for aggregation.
- The final output (metrics of throughput, response times, etc.) is then formatted and returned to the user.
c. Architectural Patterns and Design Principles:
- Modularity: Clear separation of concerns by splitting functionality into dedicated packages (config, loader, tester, metrics).
- Separation of Concerns: The CLI, configuration parsing, testing engine, and metrics reporting are separated, making the system maintainable.
- Extensibility: The use of a model package and internal modules indicates that additional testing features or metrics can be integrated in the future.
- Containerization: The presence of a Dockerfile implies that deployment and execution in a containerized environment is supported.

##### Additional Diagramming Guidance
- Detail and clarity – ensure that every module and its interactions are represented.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Input/Configuration"
        CLI["CLI/Entry Point"]:::module
        Config["Configuration Manager"]:::module
    end

    subgraph "Processing Engine"
        Loader["Data Loader"]:::module
        Tester["Load Tester / Engine"]:::module
    end

    subgraph "Output & Metrics"
        Metrics["Metrics Analyzer"]:::module
    end

    subgraph "Data Models"
        Models["Data Models"]:::data
    end

    Docker["Containerization"]:::container

    CLI -->|"parses"| Config
    Config -->|"configures"| Loader
    Config -->|"configures"| Tester
    Loader -->|"suppliesCollection"| Tester
    Loader -->|"creates"| Models
    Tester -->|"generatesMetrics"| Metrics
    Docker -.->|"runsInContainer"| CLI

    click CLI "https://github.com/burden-load/burden/blob/master/cmd/main.go"
    click Config "https://github.com/burden-load/burden/blob/master/internal/config/config.go"
    click Loader "https://github.com/burden-load/burden/blob/master/internal/loader/loader.go"
    click Tester "https://github.com/burden-load/burden/blob/master/internal/tester/tester.go"
    click Metrics "https://github.com/burden-load/burden/blob/master/internal/metrics/metrics.go"
    click Models "https://github.com/burden-load/burden/blob/master/pkg/model/request.go"
    click Docker "https://github.com/burden-load/burden/tree/master/Dockerfile"

    classDef module fill:#BBDEFB,stroke:#0D47A1,stroke-width:2px;
    classDef data fill:#FFCDD2,stroke:#B71C1C,stroke-width:2px;
    classDef container fill:#FFF9C4,stroke:#F57F17,stroke-width:2px;
```
