# akfvh/ditto architecture

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

- Interactive diagram: https://gitdiagram.com/akfvh/ditto
- Repository: https://github.com/akfvh/ditto

## Overview

DITTO extends OpenWhisk activation execution with per-action memory right-sizing: the controller classifies activation behavior, the invoker and host agent probe container memory, and committed sizes inform pool accounting. The graph emphasizes that workflow and its distinct protection and measurement stages. README statements support the DITTO interactions; sampled controller and scheduler code also shows broader OpenWhisk request handling, but the excerpts do not establish their full runtime wiring.

Main entry points: [`ditto-agent/main.go`](https://github.com/akfvh/ditto/blob/main/ditto-agent/main.go) (Probe state machine), [`core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ProbingAgentBridge.scala`](https://github.com/akfvh/ditto/blob/main/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ProbingAgentBridge.scala) (Agent bridge), [`core/controller/src/main/scala/org/apache/openwhisk/core/controller/Controller.scala`](https://github.com/akfvh/ditto/blob/main/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Controller.scala) (Controller API), [`core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/InvokerReactive.scala`](https://github.com/akfvh/ditto/blob/main/core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/InvokerReactive.scala) (Invoker runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Control plane"]
  node_controller["Controller API<br/>[Controller.scala]"]
  node_classifier["IAT/CV classifier"]
  node_scheduler["Activation scheduler"]
  node_queue["Activation queues<br/>[QueueManager.scala]"]
  node_activations[("Activation records")]
end

subgraph group_invoker["Invoker runtime"]
  node_invoker["Invoker runtime"]
  node_proxy["Container proxy"]
  node_bridge["Agent bridge"]
  node_pool["Pool accounting"]
  node_actionstats["Action statistics<br/>[ActionStats.scala]"]
end

subgraph group_agent["DITTO host agent"]
  node_agent["Probe state machine<br/>[main.go]"]
  node_monitor["Node circuit breaker<br/>[node_monitor.go]"]
end

subgraph group_host["Host memory"]
  node_cgroups[("Container cgroups")]
  node_psi["PSI pressure events"]
end

node_user(("Action caller"))

node_user -->|"invokes action"| node_controller
node_controller -->|"classifies requests"| node_classifier
node_classifier -->|"adds IAT/CV"| node_invoker
node_invoker -.->|"dispatches activation"| node_proxy
node_proxy -->|"requests probe"| node_bridge
node_bridge -->|"HTTP probe/commit"| node_agent
node_agent -->|"adjusts memory.high"| node_cgroups
node_cgroups -->|"emits pressure"| node_psi
node_psi -->|"restores and retries"| node_agent
node_agent -->|"checks node limit"| node_monitor
node_agent -->|"sends commits"| node_bridge
node_bridge -->|"updates commits"| node_pool
node_pool -->|"accounts downsized space"| node_proxy
node_controller -.->|"submits activations"| node_scheduler
node_scheduler -->|"creates and recovers queues"| node_queue
node_invoker -.->|"stores results"| node_activations

click node_controller "https://github.com/akfvh/ditto/blob/main/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Controller.scala"
click node_classifier "https://github.com/akfvh/ditto/blob/main/core/controller/src/main/scala/org/apache/openwhisk/core/controller/actions/PrimitiveActions.scala"
click node_invoker "https://github.com/akfvh/ditto/blob/main/core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/InvokerReactive.scala"
click node_proxy "https://github.com/akfvh/ditto/blob/main/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala"
click node_bridge "https://github.com/akfvh/ditto/blob/main/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ProbingAgentBridge.scala"
click node_pool "https://github.com/akfvh/ditto/blob/main/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerPool.scala"
click node_actionstats "https://github.com/akfvh/ditto/blob/main/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ActionStats.scala"
click node_agent "https://github.com/akfvh/ditto/blob/main/ditto-agent/main.go"
click node_monitor "https://github.com/akfvh/ditto/blob/main/ditto-agent/node_monitor.go"
click node_scheduler "https://github.com/akfvh/ditto/blob/main/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/container/ContainerManager.scala"
click node_queue "https://github.com/akfvh/ditto/blob/main/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/queue/QueueManager.scala"
click node_activations "https://github.com/akfvh/ditto/blob/main/common/scala/src/main/scala/org/apache/openwhisk/core/database/ArtifactStore.scala"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_controller,node_classifier,node_scheduler,node_queue,node_activations toneBlue
class node_invoker,node_proxy,node_bridge,node_pool,node_actionstats toneAmber
class node_agent,node_monitor toneMint
class node_cgroups,node_psi toneRose
class node_user toneIndigo
```

## Components

### Control plane

- [Controller API](https://github.com/akfvh/ditto/blob/main/core/controller/src/main/scala/org/apache/openwhisk/core/controller/Controller.scala): `core/controller/src/main/scala/org/apache/openwhisk/core/controller/Controller.scala`
- [IAT/CV classifier](https://github.com/akfvh/ditto/blob/main/core/controller/src/main/scala/org/apache/openwhisk/core/controller/actions/PrimitiveActions.scala): `core/controller/src/main/scala/org/apache/openwhisk/core/controller/actions/PrimitiveActions.scala`
- [Activation scheduler](https://github.com/akfvh/ditto/blob/main/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/container/ContainerManager.scala): `core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/container/ContainerManager.scala`
- [Activation queues](https://github.com/akfvh/ditto/blob/main/core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/queue/QueueManager.scala): `core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/queue/QueueManager.scala`
- [Activation records](https://github.com/akfvh/ditto/blob/main/common/scala/src/main/scala/org/apache/openwhisk/core/database/ArtifactStore.scala): `common/scala/src/main/scala/org/apache/openwhisk/core/database/ArtifactStore.scala`

### Invoker runtime

- [Invoker runtime](https://github.com/akfvh/ditto/blob/main/core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/InvokerReactive.scala): `core/invoker/src/main/scala/org/apache/openwhisk/core/invoker/InvokerReactive.scala`
- [Container proxy](https://github.com/akfvh/ditto/blob/main/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala): `core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerProxy.scala`
- [Agent bridge](https://github.com/akfvh/ditto/blob/main/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ProbingAgentBridge.scala): `core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ProbingAgentBridge.scala`
- [Pool accounting](https://github.com/akfvh/ditto/blob/main/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerPool.scala): `core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ContainerPool.scala`
- [Action statistics](https://github.com/akfvh/ditto/blob/main/core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ActionStats.scala): `core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/ActionStats.scala`

### DITTO host agent

- [Probe state machine](https://github.com/akfvh/ditto/blob/main/ditto-agent/main.go): `ditto-agent/main.go`
- [Node circuit breaker](https://github.com/akfvh/ditto/blob/main/ditto-agent/node_monitor.go): `ditto-agent/node_monitor.go`

### Host memory

- **Container cgroups**
- **PSI pressure events**

### Other components

- **Action caller**

## Connections

- Action caller → Controller API: invokes action (evidence: `README.md`)
- Controller API → IAT/CV classifier: classifies requests (evidence: `README.md`)
- IAT/CV classifier → Invoker runtime: adds IAT/CV (evidence: `README.md`)
- Invoker runtime → Container proxy: dispatches activation
- Container proxy → Agent bridge: requests probe (evidence: `README.md`)
- Agent bridge → Probe state machine: HTTP probe/commit (evidence: `README.md`)
- Probe state machine → Container cgroups: adjusts memory.high (evidence: `README.md`)
- Container cgroups → PSI pressure events: emits pressure (evidence: `README.md`)
- PSI pressure events → Probe state machine: restores and retries (evidence: `README.md`)
- Probe state machine → Node circuit breaker: checks node limit (evidence: `README.md`)
- Probe state machine → Agent bridge: sends commits (evidence: `README.md`)
- Agent bridge → Pool accounting: updates commits (evidence: `README.md`)
- Pool accounting → Container proxy: accounts downsized space (evidence: `README.md`)
- Controller API → Activation scheduler: submits activations
- Activation scheduler → Activation queues: creates and recovers queues (evidence: `core/scheduler/src/main/scala/org/apache/openwhisk/core/scheduler/queue/QueueManager.scala`)
- Invoker runtime → Activation records: stores results
