Skip to content

Architecture Overview

mirazola-ik edited this page Dec 9, 2025 · 2 revisions

Architecture overview

This document provides a high-level overview of the Serverless Runtime architecture, focusing on the core components, their responsibilities, and how they interact to serve Function-as-a-Service (FaaS) requests.

High-Level design

  • The Serverless Runtime exposes a public FastAPI REST server (app/main.py) that accepts FaaS requests.
  • Internally, it uses a set of private modules to parse requests, execute functions (Python/C), interact with storage (MinIO), and communicate with the message broker (RabbitMQ).
  • The runtime also exports execution metrics to the COGNIT Framework via Prometheus.
  • The design separates concerns across well-defined modules: API, models, parsing/serialization, execution, messaging, storage, logging, and metrics.

Key processes

  • FaaS requests handled via FastAPI (/v1/faas/execute-sync).
  • Metrics collection and exposure through a Prometheus HTTP endpoint.

Architecture & components

The Serverless Runtime provides a public FastAPI REST Server that listens to FaaS requests, making use of the functionalities given by the private API components and abstracting them from the user for convenience. Multiple components are involved in the execution of the task offloading function:

  • FaaS Models: Provide the data structures needed for the requests and internal communication between function calls. Files: app/models/faas.py, app/models/daas.py.
  • FaaS Parser: Responsible for serializing offloaded functions and deserializing results returned from the Serverless Runtime. File: app/modules/_faas_parser.py.
  • Logger: Provides a structured logging interface with multiple levels. File: app/modules/_logger.py.
  • Executor: Encapsulates logic to execute Python and C languages. File: app/modules/_executor.py.
  • PyExec: Inherits from Executor and extends its Python execution functionalities. File: app/modules/_pyexec.py.
  • Metrics Exporter: Exposes runtime metrics to the COGNIT Framework via Prometheus. Implementation distributed in app/main.py and app/api/v1/faas.py.
  • Minio Client: Enables CRUD operations with the MinIO server deployed in the COGNIT Framework. File: app/modules/_minio_client.py.
  • RabbitMQ Client: Communicates with the RabbitMQ broker in the Edge Cluster, supporting message-based offloading and consumption. File: app/modules/_rabbitmq_client.py.

Deployment & runtime notes

  • The FastAPI app (app/main.py) initializes Prometheus metrics and can spawn a RabbitMQ consumer thread when run directly.
  • Uvicorn logging is integrated with the runtime logger for consistent error/access reporting.
  • Prometheus metrics are exposed on port 9100; the API server defaults to port 8000.

Related files

  • API: app/api/v1/faas.py
  • Entry point: app/main.py, app/entrypoint.sh
  • Models: app/models/faas.py, app/models/daas.py
  • Execution: app/modules/_executor.py, app/modules/_pyexec.py
  • Parsing: app/modules/_faas_parser.py
  • Messaging: app/modules/_rabbitmq_client.py
  • Storage: app/modules/_minio_client.py
  • Logging: app/modules/_logger.py
  • Tests: app/test/

Clone this wiki locally