News for hackers. Stuff that matters.
Re:Show HN: Measure CO2 emissions of your APIs by stingraycharles on Tuesday November 15, 2022 @10:05AM (#33609982)
The first question I have is: how? How do you calculate this?

Its’s neither obvious from your post nor your GitHub landing page, which is a shame.

The other question I would have is: who is the target audience, and why are API calls specifically so important?

Re:Show HN: Measure CO2 emissions of your APIs by cryptonym on Tuesday November 15, 2022 @10:20AM (#33610176)
> Annual Internet Energy / Annual End User Traffic = 0.81 kWh/GB

> Carbon factor (global grid): 442 g/kWh

Probably just checking how many bytes the response is. While that's a good idea to remove unused data from your response, this test may promote wrong patterns such as spreading data over multiple request/response. This would consume more energy but won't be visible with a naive CO2 computation.

Re:Show HN: Measure CO2 emissions of your APIs by ushakov on Tuesday November 15, 2022 @10:43AM (#33610551)
that’s correct, we should also mention that spreading data over multiple requests does not improve co2 usage
Re:Show HN: Measure CO2 emissions of your APIs by cryptonym on Wednesday November 16, 2022 @07:52AM (#33622188)
Raising awareness on such topic and providing visibility to devs is a good thing. Unfortunately, numbers may be off by multiple orders of magnitude. It's really hard to get any meaningful CO2 number for a single API call. I'd suspect API burn much more CO2/byte than streaming.

Streaming is dumb, cacheable near end-users and heavy in bandwidth. API uses little bandwidth but often requires calls to multiple remote backend systems heavy in CPU, including subrequests to databases and other stuff. When you mix all usage and get an average KPI, it's no longer representative.

Re:Show HN: Measure CO2 emissions of your APIs by privong on Tuesday November 15, 2022 @10:08AM (#33610035)
The page linked by the HN post title (https://docs.stepci.com/guides/co2-testing.html) says:

> The calculation algorithm is provided by Sustainable Web Design

And links to: https://sustainablewebdesign.org/calculating-digital-emissio...

Re:Show HN: Measure CO2 emissions of your APIs by ttrrooppeerr on Tuesday November 15, 2022 @10:13AM (#33610098)
That page:

> NOTE: This page is regularly updated to include the most recent research and information.

Also, the same page:

> Last update: April 17, 2022.

Call me naive but I was hoping research in this area will be faster/more frequent, given also the Cop27.