Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Infrastructure

The system leverages AWS services for scalability and security, with SQS for event-driven invocations.

%%{init: {
  "theme": "base",
  "themeVariables": {
    "primaryColor": "#0b5cab",
    "primaryTextColor": "#ffffff",
    "lineColor": "#6b7280",
    "tertiaryColor": "#eef2ff",
    "fontFamily": "Segoe UI, Roboto, Helvetica, Arial, sans-serif"
  },
  "flowchart": { "diagramPadding": 8, "curve": "basis" }
}}%%
flowchart TD
  %% ---------------------------
  %% Nodes (defined first)
  %% ---------------------------
  EB[EB Scheduler]
  TM[Task Manager]
  WP1[Workers]
  WP2[Workers]
  SQS[SQS Queue]
  TT[(Task Table)]
  DT[(Data Table)]
  ST[(Statistics Table)]

  %% ---------------------------
  %% Subgraphs / groupings
  %% ---------------------------
  subgraph PG[PostgreSQL]
    ST
    TT
    DT
  end

  subgraph VPC[AWS VPC]
    TM
    PG
    WP2
  end

  subgraph EXT[External]
    WP1
  end

  %% ---------------------------
  %% Edges
  %% ---------------------------
  EB  -->| Check task timeouts
  5 min | SQS
  EB  -->| Gather statistics
  1 hour | SQS
  EB  -->| Cleanup old tasks and data
  1 day | SQS
  WP1 -->| Push completion | SQS
  WP2 -->| Push completion | SQS
  SQS -->| Trigger invoke | TM

  TM  -->| Store statistics | ST
  TM  -->| Manage tasks | TT
  TM  -->| Mutate data | DT
  WP2 -->| Mutate data | DT

  TM  -->| Dispatch tasks | WP1
  TM  -->| Dispatch tasks | WP2

  %% ---------------------------
  %% Styling
  %% ---------------------------
  %% Database tables as cylinders (already set by [( )]); add color:
  classDef db fill:#89CFF0,stroke:#0096FF,stroke-width:1px,color:#3b2f00;
  class ST,TT,DT db;

  classDef rounded rx:8,ry:8,stroke:#2b5fab,stroke-width:1.2px,fill:#0b5cab,color:#ffffff;
  class TM,WP1,WP2 rounded;

  classDef roundedInfra rx:8,ry:8,stroke:#F36717,stroke-width:1.2px,fill:#E25606,color:#ffffff;
  class EB,SQS roundedInfra;

  %% Subgraph backgrounds & borders
  style PG  fill:#fff6e5,stroke:#ff8c00,stroke-width:2px,rx:10,ry:10
  style VPC fill:#f0f7ff,stroke:#0b5cab,stroke-width:1.5px,rx:10,ry:10
  style EXT fill:#f7f7f7,stroke:#9ca3af,stroke-width:1px,rx:10,ry:10

  %% Links (edges)
  linkStyle default stroke:#6b7280,stroke-width:2px