Integrating the Carbon Aware API with HarperDB Custom Functions allows for ML workloads and cache requests to be directed to the greenest node in the cluster.
A Cluster can be setup to act as a smart API cache, allowing for the closest Edge-based node to respond to requests for external APIs - this reduces calls to the origin server which decreases the response time.
In this project we incorporated the Carbon Aware API so that those requests could be routed to the greenest node in the cluster.
We did the same for ML workloads, allowing the training and the inference to be executed on the node with the lowest carbon impact.
These two examples each have their own repo:
The Green API Cache is setup as a LIVE demo and can be used by making a cURL request to GET https://functions-green-one-kevin.harperdbcloud.com/green-cache/url?EXTERNAL_URL. This will cache the response from EXTERNAL_URL so additional requests will be responded to from the greenest node in the cluster (one is running on US East and another on US West). The hdb-greenest-node response header indicates which node did the work.