Skip to content

BlckKn1fe/serverless-graph-autoscale-prototype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless Graph Autoscale Prototype

Project overview

This repository is a focused research prototype for predictive autoscaling in serverless computing. It studies a narrow question: whether lightweight graph-aware features derived from function invocation dependencies can improve next-step demand prediction and autoscaling decisions compared with a reactive moving-average baseline.

The project intentionally avoids heavy cloud infrastructure and deep learning frameworks. It uses synthetic but structured serverless workload data, a directed function dependency graph, scikit-learn models, and reproducible evaluation scripts that run on a normal laptop within a few minutes.

Research problem

Serverless platforms scale functions dynamically, but many autoscaling mechanisms respond after demand has already shifted. In applications composed of multiple functions, a spike in one upstream function can propagate to downstream functions. A reactive scaler that only observes each function in isolation may miss this propagation pattern.

This prototype evaluates the following research problem:

Can graph-derived upstream demand features improve short-horizon serverless invocation prediction and reduce underprovisioning risk relative to a reactive local-history baseline?

Why the topic matters

Modern cloud applications often use serverless functions for event-driven workflows, APIs, data pipelines, and microservice backends. When scaling decisions are late, users may experience cold-start latency. When scaling decisions are too conservative, providers or application teams may overprovision resources. A topology-aware predictor can help study how function dependency structure may support earlier scaling decisions.

Repository structure

serverless-graph-autoscale-prototype/
  README.md
  requirements.txt
  LICENSE
  .gitignore
  src/
    __init__.py
    data_generator.py
    preprocessing.py
    baseline.py
    model.py
    evaluation.py
    visualization.py
  experiments/
    run_experiment.py
  docs/
    methodology.md
    limitations.md
    research_positioning.md
  tests/
    test_basic.py

Installation

git clone <your-repo-url>
cd serverless-graph-autoscale-prototype
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install -r requirements.txt

Quick start

Run the full experiment:

python experiments/run_experiment.py

Run tests:

pytest

The experiment creates an outputs/ folder containing:

outputs/
  synthetic_serverless_workload.csv
  function_dependency_edges.csv
  metrics.csv
  prediction_trace.csv
  metric_comparison.png
  prediction_trace.png

Methodology summary

The prototype compares two methods:

  1. Reactive moving-average baseline
    Predicts next-step function invocation demand from recent local invocation lags only. This approximates a simple reactive autoscaling policy.

  2. Graph-aware predictive model
    Builds lightweight dependency features from the function invocation graph, including weighted upstream demand, weighted fan-in, and fan-out. These features approximate a graph message-passing idea without requiring a heavy GNN library. A small scikit-learn random forest regressor predicts next-step demand.

Evaluation includes both forecasting metrics and autoscaling-oriented metrics:

  • MAE
  • RMSE
  • SMAPE
  • Underprovisioning rate
  • Mean shortage
  • Mean excess capacity
  • Cold-start proxy
  • Mean capacity units

Example output

A typical run prints a table similar to:

Experiment completed. Metrics:

                 method     mae    rmse  smape     r2  underprovision_rate  mean_shortage  mean_excess_capacity  cold_start_proxy  mean_capacity_units
reactive_moving_average   ...     ...    ...    ...                ...            ...                  ...              ...                 ...
 graph_aware_predictive   ...     ...    ...    ...                ...            ...                  ...              ...                 ...

Exact values can vary slightly by Python and package versions, but the script fixes the random seed for reproducibility.

Limitations

This is a controlled research prototype rather than a production autoscaler. It uses synthetic workload data, simplified capacity assumptions, and a lightweight graph-feature model. It does not connect to AWS Lambda, Azure Functions, Google Cloud Functions, Kubernetes, Knative, or a real billing system.

Future work

Possible extensions include:

  • Replacing synthetic traces with public serverless or microservice workload traces when available.
  • Adding reinforcement-learning policy optimization after demand prediction.
  • Modeling multi-provider constraints such as region availability, migration delay, and cost heterogeneity.
  • Adding uncertainty-aware scaling decisions.
  • Testing more expressive graph models when heavier dependencies are acceptable.

Disclaimer

This repository is a research prototype. It is designed to demonstrate a reproducible technical implementation of a narrow cloud systems research problem. It should not be treated as a production autoscaling service or as a validated cloud cost optimization product.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages