Skip to content

Optimising delivery of serverless functions across geo-spatial multi-clusters in the cloud for carbon efficiency.

License

Notifications You must be signed in to change notification settings

thandayuthapani/GreenCourier

Repository files navigation

GreenCourier

GreenCourier is a carbon-aware Kubernetes plugin to intelligently schedule serverless functions in regions of low carbon emission using Carbon-Aware-SDK. GreenCourier optimises delivery of serverless functions across geo-spatial multi-cluster Kubernetes environment in the cloud for carbon efficiency. GreenCourier has production-ready tech stack and one-click away from integrating with existing geographically distributed clusters with Liqo.

System Architecture

System Architecture

Installation

We need a cluster with Knative enabled in management cluster and target clusters which are geographically distributed to be connected to management cluster using Liqo.

Once the cluster setup up is done, it is important for us to install metrics-collector and Carbon-Aware-SDK's WebAPI in local cluster.

# Replace $USERNAME and $PASSWORD with WattTime credentials in deployment YAML
kubectl apply -f metrics-collector/deployment/deployment.yaml

Once metrics-collector is deployed, we can deploy the plugin code using Helm using following command:

helm install GreenCourier carbon-scheduler/charts/

When metrics-collector and plugin code is deployed, we can just start deploying functions in Knative with just addition of one line in the function spec YAML.

...
spec:
  schedulerName: kube-carbon-scheduler
...

Example function spec with schedulerName added.

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: hello
  namespace: default
spec:
  template:
    metadata:
      annotations:
        autoscaling.knative.dev/target: "10"
    spec:
      schedulerName: kube-carbon-scheduler
      containers:
        - image: gcr.io/knative-samples/helloworld-go
          ports:
            - containerPort: 8080
          env:
            - name: TARGET
              value: "GreenCourier Demo"

Evaluation

As shown in the system architecture, we deployed 3 clusters in different regions and load tested our solution. And the result of the evaluation is show as following:

EvalResult

It is very much evident that our proposed solution does impact scheduling decisions, tremendously reducing carbon footprint for function execution. We calculate efficiency value for function placement by following formula:

$$ Placement Efficiency = \frac{number\ of\ function\ instances\ deployed\ in\ possible\ carbon\ efficient\ region}{total\ number\ of\ function\ instances\ executed} $$

Similarly, Carbon efficiency was calculated by taking weighted average of carbon score divided by best possible result for execution.

$$ Carbon Efficiency = \frac{\Sigma number\ of\ function\ instances\ deployed\ in\ a\ region \times Carbon\ score\ of\ that\ region}{Best\ possible\ score\ for\ the\ given\ workload} $$

Extending GreenCourier

GreenCourier is built using Kubernetes Scheduling Framework. It is possible to extend GreenCourier just as extending Kubernetes Scheduler for which there are numerous publicly available documentation.

References

  1. Immersion cooling heats up - Greengard, Samuel
  2. Serverless in the Wild: Characterizing and Optimizing the Serverless Workload at a Large Cloud Provider
  3. How much energy do data centers use?
  4. Global Serverless Architecture Market To Reach USD 86.94 Billion By 2030

Contact

Thandayuthapani Subramanian 📧 Linkedin GitHub
Mohak Chadha 📧Linkedin GitHub

About

Optimising delivery of serverless functions across geo-spatial multi-clusters in the cloud for carbon efficiency.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages