Skip to content
unimib-datAIPublic

About

Decentralized FaaS platform

Topics

Resources

Stars

24 stars

Watchers

4 watching

Forks

Repository files navigation

DFaaS: Decentralized Function-as-a-Service for Federated Edge

DFaaS logo

This repository contains DFaaS, a decentralized FaaS-based architecture designed to automatically and autonomously balance the traffic load across edge nodes belonging to federated Edge Computing ecosystems.

DFaaS implementation relies on an overlay peer-to-peer network and a decentralized control algorithm that takes decisions on load redistribution. Although preliminary, our results confirm the feasibility of the approach, showing that the system can transparently redistribute the load across edge nodes when they become overloaded.

Our prototype is based on OpenFaaS Community Edition, HAProxy, and Prometheus and a custom control logic implemented in Go.

This research is conducted by the DatAI (formerly Insid&s) and NetLab (formerly REDS) research laboratories of the Department of Informatics, Systems and Communication (DISCo), University of Milano-Bicocca.

If you wish to reuse this source code, please consider citing our article describing the first prototype:

@inproceedings{Ciavotta_DFaaS_2021,
    author = {Ciavotta, Michele and Motterlini, Davide and Savi, Marco and Tundo, Alessandro},
    doi    = {10.1109/CloudNet53349.2021.9657141},
    pages  = {1--4},
    series = {2021 IEEE 10th International Conference on Cloud Networking (CloudNet)},
    title  = {{DFaaS: Decentralized Function-as-a-Service for Federated Edge Computing}},
    url    = {https://ieeexplore.ieee.org/document/9657141},
    year   = {2021}
}

Scenario & Architecture

Scenario

The above figure depicts the considered network scenario. A set of geographically-distributed FaaS-enabled edge nodes (or simply edge nodes) is deployed at the edge of the access network.

Each of these nodes deploys a DFaaS platform for the execution of serverless functions, and is connected to a wireless or wired access point (e.g. a base station, a broadband network gateway, a WiFi access point, etc.).

The edge node can receive functions' execution requests, in the form of HTTP requests, generated by the users served by the access point.

The following image summarizes the DFaaS architecture:

Architecture

For more information about the architecture, see docs/overview.md file.

How to run DFaaS

DFaaS is currently at a prototype stage. It relies on HAProxy for the proxy component, OpenFaaS CE as the Function-as-a-Service platform, and Prometheus for metrics collection. Kubernetes is the only supported deployment environment.

The DFaaS prototype has been tested with Ubuntu 24.04.3 LTS and K3S as the Kubernetes distribution.

We recommend starting with fresh virtual machines (VMs) running Ubuntu. You can deploy one DFaaS platform per VM.

For more information about DFaaS, refer to the documentation in the docs directory.

Deploy with just

DFaaS is deployed on the local node with just. The node needs:

  • buildah, to build the images,
  • k3s, installed with INSTALL_K3S_EXEC="--disable traefik",
  • Helm v3 (v4 is not supported),
  • faas-cli in /opt/bin for OpenFaaS, or wsk in /opt/bin and zip for OpenWhisk.

Build the agent image, then deploy the whole node. CONFIG.yaml is the Helm values file of the agent:

$ just agent k3s
$ just deploy-all CONFIG.yaml

Or skip the build and deploy the public images with just images=public deploy-all CONFIG.yaml.

See docs/commands.md for the agent's configuration, the other deployment modes and how to deploy OpenWhisk, and docs/build.md for building the images.

You can make automatic calls to the node with k6. More information about it in the dedicated directory.

Deploy functions

Use faas-cli to deploy functions to the local DFaaS instance with OpenFaaS, or wsk for OpenWhisk.

Under the functions/ directory you can found some custom functions for OpenFaaS and OpenWhisk. You can deploy them with just deploy-functions, see docs/commands.md for this and the other deployment modes.

Invoke a function

Each node exposes HAProxy with port 30080 on the node's IP address. Only http protocol is supported. You can use any program to make a call, as example:

$ curl -i http://127.0.0.1:30080/function/figlet -d 'Hello DFaaS world!'

In this case we assume that you have deployed the figlet function.

Forwarding traffic as a malicious node

You can impersonate a malicious node that is not part of the federation by adding the header Dfaas-Node-Id with a value that is not a valid peer id of the network (e.g., Dfaas-Node-Id: malicious-id). All of its requests will be rejected.

Troubleshooting

See and follow the logs of the DFaaS Agent on the local instance:

$ POD=$(sudo kubectl get pods -l app=dfaas-agent -o jsonpath="{.items[0].metadata.name}")
$ sudo kubectl logs --follow $POD

Emulator

Until commit 7a8512b, an emulator was available in the emulator directory, allowing multiple DFaaS edge nodes to be emulated on a single machine using Docker and Containernet. The emulator was removed when DFaaS migrated to Kubernetes (k3s), which requires a separate VM for each node. The recommended approach is now to run multiple VMs that can automatically connect on a hypervisor, which is the method we currently use.

Simulator

We also provide a simulator to test and compare different load balancing techniques. The simulation code is available into the simulation directory. Data gathered by the DFaaS system used for simulation are available here.

For more information read associated README file.

License

Copyright © 2021-2026 The DFaaS Authors.

Unless otherwise noted, the source code in this repository is licensed under the GNU Affero General Public License (AGPL), version 2.0 or later. See the LICENSE file for more information.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

The complete list of The DFaaS Authors can be fond in the AUTHORS file or in the contributors page on the DFaaS GitHub repository.

About

Decentralized FaaS platform

Topics

Resources

Stars

24 stars

Watchers

4 watching

Forks

Packages

Used by

Contributors

Languages