# domgiles/swingbench-public architecture

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

- Interactive diagram: https://gitdiagram.com/domgiles/swingbench-public
- Repository: https://github.com/domgiles/swingbench-public

## Overview

##### Major components
- Front End/Client Tools:
– Swingbench (the graphically rich, main GUI tool)
– Minibench (a simplified, lightweight interface)
– Charbench (the command line version)
- Benchmark Workload Modules:
– Sub-packages for specific benchmarks (e.g., orderentryjdbc, orderentryplsql, json, jsonsocialnetwork, moviestream, saleshistory, sharded, storedprocedures, stresstest, etc.). These represent distinct types of workloads simulated by the engine.
- Schema and Data Setup Wizards:
– Multiple wizards (e.g., oewizard, shwizard, jsonwizard, jsonsocialwizard, moviewizard, tpcdswizard, tpchwizard) located in the “bin” directory (as mentioned in the README). They are responsible for creating the schema and inserting sample data into the database.
- Utility Tools:
– sbutil utility for schema validation, reloading packages, and troubleshooting.
– results2pdf for converting XML test results to a nicely formatted PDF.
– Additional scripts such as parse_results.py for comparing and formatting run results.

##### Interactions and relationships
- The user (tester or DBA) interacts with one of the front ends (Swingbench, minibench, charbench) to initiate a benchmark run.
- The front end reads the configuration settings (from XML config files as described) and then directs the core benchmark engine to run the specific workload (one of the benchmark modules) against a target database.
- The benchmark modules (each defined in their respective Java packages under src/com/dom/benchmarking/swingbench/benchmarks) execute simulated transactions (e.g., order entry transactions, JSON CRUD operations, social network interactions, movie streaming requests, etc.).
- The data setup wizards (invoked as separate executables) are used before running benchmarks to install the appropriate database schema and populate data.
- Utility tools (like sbutil & results2pdf) act as supporting systems that interface with the database schema or benchmarking results.

##### Architectural aspects and design principles
- Modular Design: The project is organized into a core “benchmarking engine” with distinct benchmark packages that are modular in nature – each simulating a different workload scenario.
- Front End Abstraction: Having multiple interfaces (GUI and command line) showcases the separation of concerns where the same core benchmark engine is accessible via different interaction modes.
- Configuration-Driven Execution: Workload parameters and database connection details are passed via XML configuration files, indicating a design that allows flexible run-time configuration.

- A note indicating the project’s dependency on Java 17+ and the use of XML for configuration and results output.

## Diagram (Mermaid)

```mermaid
flowchart TD
    U["User (Tester/DBA)"]:::user

    subgraph "Front End Clients"
        SB["Swingbench GUI"]:::frontend
        CB["Charbench CLI"]:::frontend
        MB["Minibench CLI"]:::frontend
    end

    U --> SB
    U --> CB
    U --> MB

    SB --> CE["Core Benchmark Engine"]:::engine
    CB --> CE
    MB --> CE

    subgraph "Benchmark Modules"
        OE_JDBC["Order Entry (JDBC)"]:::benchmark
        OE_JDBCAC["Order Entry (JDBC_AC)"]:::benchmark
        OE_PLSQL["Order Entry (PLSQL)"]:::benchmark
        OE_TrueCache["Order Entry (TrueCache)"]:::benchmark
        JSON_Mod["JSON Benchmark Module"]:::benchmark
        JSON_SN["JSON Social Network Benchmark Module"]:::benchmark
        Movie_Mod["Movie Streaming Benchmark Module"]:::benchmark
        Sales_Mod["Sales History Benchmark Module"]:::benchmark
        Sharded_JDBC["Sharded JDBC Transactions"]:::benchmark
        Sharded_PLSQL["Sharded PLSQL Transactions"]:::benchmark
        Stored_Proc["Stored Procedures Benchmark Module"]:::benchmark
        Stress_Test["Stress Test Benchmark Module"]:::benchmark
    end

    CE --> OE_JDBC
    CE --> OE_JDBCAC
    CE --> OE_PLSQL
    CE --> OE_TrueCache
    CE --> JSON_Mod
    CE --> JSON_SN
    CE --> Movie_Mod
    CE --> Sales_Mod
    CE --> Sharded_JDBC
    CE --> Sharded_PLSQL
    CE --> Stored_Proc
    CE --> Stress_Test

    CE -->|"runs benchmarks"| DB[(Database)]:::database

    subgraph "Schema & Data Setup Wizards"
        OEWiz["OE Wizard"]:::wizard
        SHWiz["SH Wizard"]:::wizard
        JSONWiz["JSON Wizard"]:::wizard
        JSONSNWiz["JSON Social Wizard"]:::wizard
        MovieWiz["Movie Wizard"]:::wizard
        TPCDSWiz["TPC-DS Wizard"]:::wizard
        TPCHWiz["TPC-H Wizard"]:::wizard
    end

    OEWiz --> DB
    SHWiz --> DB
    JSONWiz --> DB
    JSONSNWiz --> DB
    MovieWiz --> DB
    TPCDSWiz --> DB
    TPCHWiz --> DB

    subgraph "Utility Tools"
        Sbutil["sbutil"]:::utility
        Results2PDF["results2pdf"]:::utility
        ParseResults["parse_results.py"]:::utility
    end

    CE --> Sbutil
    CE --> Results2PDF
    CE --> ParseResults

    CE --- CN["Note: Java 17+; Uses XML for configuration & results output"]:::note

    %% Click Events
    click SB "https://github.com/domgiles/swingbench-public/tree/master/src/com/dom/benchmarking/swingbench"
    click JSON_Mod "https://github.com/domgiles/swingbench-public/tree/master/src/com/dom/benchmarking/swingbench/benchmarks/JSON"
    click JSON_SN "https://github.com/domgiles/swingbench-public/tree/master/src/com/dom/benchmarking/swingbench/benchmarks/jsonsocialnetwork"
    click Movie_Mod "https://github.com/domgiles/swingbench-public/tree/master/src/com/dom/benchmarking/swingbench/benchmarks/moviestream"
    click OE_JDBC "https://github.com/domgiles/swingbench-public/tree/master/src/com/dom/benchmarking/swingbench/benchmarks/orderentryjdbc"
    click OE_JDBCAC "https://github.com/domgiles/swingbench-public/tree/master/src/com/dom/benchmarking/swingbench/benchmarks/orderentryjdbcac"
    click OE_PLSQL "https://github.com/domgiles/swingbench-public/tree/master/src/com/dom/benchmarking/swingbench/benchmarks/orderentryplsql"
    click OE_TrueCache "https://github.com/domgiles/swingbench-public/tree/master/src/com/dom/benchmarking/swingbench/benchmarks/orderentrytruecache"
    click Sales_Mod "https://github.com/domgiles/swingbench-public/tree/master/src/com/dom/benchmarking/swingbench/benchmarks/saleshistory"
    click Sharded_JDBC "https://github.com/domgiles/swingbench-public/tree/master/src/com/dom/benchmarking/swingbench/benchmarks/shardedjdbctransactions"
    click Sharded_PLSQL "https://github.com/domgiles/swingbench-public/tree/master/src/com/dom/benchmarking/swingbench/benchmarks/shardedplsqltransactions"
    click Stored_Proc "https://github.com/domgiles/swingbench-public/tree/master/src/com/dom/benchmarking/swingbench/benchmarks/storedprocedures"
    click Stress_Test "https://github.com/domgiles/swingbench-public/tree/master/src/com/dom/benchmarking/swingbench/benchmarks/stresstest"

    %% Styles
    classDef user fill:#FFE0B2,stroke:#FF9800,stroke-width:2px;
    classDef frontend fill:#B3E5FC,stroke:#03A9F4,stroke-width:2px;
    classDef engine fill:#C8E6C9,stroke:#4CAF50,stroke-width:2px;
    classDef benchmark fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px;
    classDef database fill:#D7CCC8,stroke:#795548,stroke-width:2px;
    classDef wizard fill:#F8BBD0,stroke:#E91E63,stroke-width:2px;
    classDef utility fill:#CE93D8,stroke:#9C27B0,stroke-width:2px;
    classDef note fill:#EEEEEE,stroke:#9E9E9E,stroke-width:1px,stroke-dasharray:5,5;
```
