How m4hf0d/faas-dave works
Project Type and Purpose
• faas-sim is an open-source, trace-driven simulation framework written in Python.
• Its goal is to model and evaluate container-based Function-as-a-Service (FaaS) platforms using discrete-event simulation (SimPy) and a network layer (Ether).
• Users can plug in custom schedulers, autoscalers, load-balancers, and request generators.
File Structure Analysis
• Top‐level directories:
• sim: core simulation engine, context definitions, platform abstractions, FaaS system modules, utilities
• ext/raith21: extensions for ML-driven scheduling, device models, workload generators
• examples: runnable scenarios demonstrating custom schedulers, load-balancers, function simulators
• notebooks: Jupyter notebooks for explorations and plotting
• doc: Sphinx documentation and architecture overviews
• Key architectural patterns:
• Factory pattern in sim/context to create platform services (deployment, network, node, replica, request, telemetry, trace, zone)
• Plugin architecture in sim/faas for scheduling, scaling, load balancing, watchdogs
• Separation of concerns between simulation core (SimPy engine) and platform models/services
Extracting Architecture Details from README
• Core technologies: SimPy (discrete events), Ether (network simulation), Skippy (default scheduler)
• Trace-driven: uses profiling data and workload traces for function execution times
• Pluggable components: schedulers, autoscalers, load-balancers
Main Components
a. Input Layer
• Workload Traces & Profiling Data (fed into Request Generator)
• Configuration Files (cluster topology, device profiles)
b. Request Generator
• sim/requestgen.py and custom request generators in examples/request_gen
c. Simulation Core
• sim/core.py: orchestrates SimPy environment
• sim/docker.py: container setup for function execution
• sim/net.py: integrates Ether network events
d. Context Factories & Models
• sim/context/*: factory modules instantiate platform components
• Each platform aspect = service + model (deployment, network, node, replica, request, telemetry, trace, zone)
e. FaaS System Modules
• sim/faas/core.py: glue between simulation and FaaS abstractions
• sim/faas/decentralized.py, scaling.py, loadbalancers.py, watchdogs.py, kvstorage.py, system.py
• ext/raith21/*: optional ML-based scheduling, generative models
f. Measurement & Analysis
• sim/metrics.py: collects and computes performance metrics
• sim/logging.py: event logging
• sim/oracle: ground truth services (for evaluation)
g. Output & Visualization
• CLI reports, logs, and notebook interfaces (notebooks/)
Relationships and Data Flows
• Simulation Core ↔ Context Services (network events, deployment, node lifecycle, telemetry)
• Simulation Core ↔ FaaS System Modules (scheduling decisions, autoscaling triggers, load balancing)
• FaaS System Modules → Resource Model (sim/resource.py) → Execution in containers (sim/docker.py)
• Telemetry & Tracing Services report back to Metrics & Oracle for analysis
Architectural Patterns & Design Principles
• Discrete Event Simulation (SimPy) drives all events
• Factory pattern for modular platform component instantiation
• Plugin architecture allows swapping scheduling/scaling/LB implementations
• Clear separation: Core engine vs. platform services vs. FaaS logic vs. extensions
Detail Level
• Plugin interfaces in sim/faas to show where users drop in custom code