Green-Software-Foundation / hack

Carbon Hack 24 - The annual hackathon from the Green Software Foundation
https://grnsft.org/hack/github
15 stars 2 forks source link

API Carbon Score #100

Open agwlprince617 opened 6 months ago

agwlprince617 commented 6 months ago

Prize category

Best Content

Overview

API Carbon Score with baseline footprint

Project team

@Dhanushguptha19 @gmlavanya @Harsha-kommuru

Terms of Participation

Project Submission

Summary

API Carbon Score is a tool which gives the carbon score with baseline footprint to enable consumer to optimize invocation and adoption. We combine Impact Framework and other tools and libraries which can give us metrics for real time carbon score for each API invocation.

Problem

Each day there are billions of API calls that are made which contribute significantly to the carbon footprint enormously. Some of these emissions are not necessary and at a larger scale we are talking about a potential upside in the carbon emissions every day. We as developers do not have the insights as to how much carbon is emitted at the API level. The problem at hand is to give these valuable insights to the developers who can make informed decisions to optimize the invocation.

Application

We have a client/server architecture with the API gateway in between which routes the request. Whenever we make a call the gateway routes it to the server. Now at the server there will be a Process ID related to the process. We calculate the footprint at the JVM level using power measuring tools such as JoularjX. Moreover there is embodied carbon at the Gateway and the network footprint due to the request and response sizes. We sum all this with the help of the SCI plugin and return this baseline carbon score to the end user.

Prize category

Best Content

Judging Criteria

Overall Impact 👩🏽‍⚖️ The potential upside would be that developers will become more conscious while invoking API's as each API will have the baseline carbon footprint. This conscious efforts will not only pursue us to control the amount of carbon that is emitted daily but will bring a change in how we approach IT based solutions for a sustainable environment around us.

Clarity We have prepared a detailed technical documentation on this topic as well as the demo video for better understanding.

Innovation We have done some research and we could not find ideas that exhibit what we plan to achieve. We have also referred multiple tools and libraries in this domain and tried to integrate it to our project.

Video

API Carbon Score

Content

API Carbon Score Technical Documentation

Process

We built a sample spring boot application with some test API's. We utilized JoularjX to give the JVM level insights combining it with IF to calculate the carbon impact. This metrics are then pushed as response payload to the user as the carbon score.

Inspiration

As part of the SDLC process in our day to day life we use Postman/SoapUi to invoke API's. Many times it is unnecessary for example if a session is generated for 5 mins we don't need to invoke the API before 5 mins. We thought of a solution where we could give the developer's insights on these metrics to contribute to greener IT.

Challenges

Building a team and then collaborating together with so many ideas in place. Also, to come up with this idea we spent lot of time thinking before actually implementing the solution. Since there is no much research done on this we faced challenges in coming up with a innovative approach to contribute to the hackathon. We were also involved in customer commitments but all of us worked hard to put this content in place.

Accomplishments

We accomplished a lot, from having no idea to actually submitting 5 ideas and then implementing a few. We worked as a team and came up with a innovative solution.

Learnings

We learnt a lot about IF and green IT.

What's next?

The goal is to provide insights and relevant metrics to the developers and people actually using this tool to raise awareness. We want to add real-time metrics at the Gateway level and enhance the way we calculate the energy at the server level.

russelltrow commented 6 months ago

Project lead is Kommuru Harsha Vardhan @Harsha-kommuru

agwlprince617 commented 5 months ago

@russelltrow , my lead was not well so updated the issue on his behalf