# joaovitormoreirapassos/horizontal-elasticity architecture

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

- Interactive diagram: https://gitdiagram.com/joaovitormoreirapassos/horizontal-elasticity
- Repository: https://github.com/joaovitormoreirapassos/horizontal-elasticity

## Overview

##### Main Components Identification
First, let's identify the key components visible in the file structure:
- Frontend (served through Nginx)
- Proxy service
- Passer service
- Server service
- Autoscaler service
- Load testing component (Locust)
- Monitoring (Prometheus)

##### Component Relationships

Use the following conventions:
- Double lines for data streaming
- Blue: User-facing components (Nginx)
- Green: Core services (Proxy, Passer, Server)
- Orange: Infrastructure services (Autoscaler)
- Gray: Monitoring and testing tools

##### Detailed Component Specifications

For each component, include:
- Container name
- Port number (if applicable)
- Primary function
- Key dependencies (from requirements.txt files)

##### Infrastructure Details

Show:
- Docker container boundaries
- Network connections between services
- Scaling capabilities (especially for the server component)

##### Specific Elements

a) Client Interaction:
**Browser -> Nginx (Port 8000) -> Proxy**

b) Core Processing Flow:
**Proxy -> Passer -> Server (Matrix Multiplication)**

c) Infrastructure Management:
**Autoscaler -> Server (scaling operations)**
**Prometheus -> All Services (monitoring)**

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    Client(("Client/Browser"))

    %% Gateway Layer
    subgraph Gateway
        Nginx["Nginx Server\nPort 8000"]:::gateway
    end

    %% Service Layer
    subgraph Services
        direction TB
        Proxy["Proxy Service\nRequest Distributor"]:::service
        Passer["Passer Service\nMatrix Handler"]:::service
        Server["Server Service\nMatrix Multiplication"]:::service
    end

    %% Infrastructure Layer
    subgraph Infrastructure
        direction TB
        Autoscaler["Autoscaler Service\nScaling Manager"]:::infra
        Prometheus["Prometheus\nMonitoring"]:::monitoring
        Locust["Locust\nLoad Testing"]:::testing
    end

    %% Relationships
    Client --> Nginx
    Nginx --> Proxy
    Proxy --> Passer
    Passer --> Server
    Autoscaler -.-> Server
    Prometheus -.-> Nginx
    Prometheus -.-> Proxy
    Prometheus -.-> Passer
    Prometheus -.-> Server
    Prometheus -.-> Autoscaler
    Locust -.-> Nginx

    %% Click Events
    click Nginx "https://github.com/JoaoVitorMoreiraPassos/horizontal-elasticity/tree/main/nginx"
    click Proxy "https://github.com/JoaoVitorMoreiraPassos/horizontal-elasticity/tree/main/proxy"
    click Passer "https://github.com/JoaoVitorMoreiraPassos/horizontal-elasticity/tree/main/passer"
    click Server "https://github.com/JoaoVitorMoreiraPassos/horizontal-elasticity/tree/main/server"
    click Autoscaler "https://github.com/JoaoVitorMoreiraPassos/horizontal-elasticity/tree/main/autoscaler"
    click Locust "https://github.com/JoaoVitorMoreiraPassos/horizontal-elasticity/tree/main/load_test"
    click Prometheus "https://github.com/JoaoVitorMoreiraPassos/horizontal-elasticity/blob/main/prometheus.yaml"

    %% Styling
    classDef gateway fill:#3498db,stroke:#2980b9,color:white
    classDef service fill:#2ecc71,stroke:#27ae60,color:white
    classDef infra fill:#e67e22,stroke:#d35400,color:white
    classDef monitoring fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef testing fill:#9b59b6,stroke:#8e44ad,color:white

    %% Legend
    subgraph Legend
        L1[Gateway Component]:::gateway
        L2[Core Services]:::service
        L3[Infrastructure]:::infra
        L4[Monitoring]:::monitoring
        L5[Testing]:::testing
        L6["--> Sync Communication"]
        L7["-.-> Async Communication"]
    end
```
