by Banditoz · 3y ago · 0 comments
Interesting, my location has "high grid intensity", so it showed me a lite version, with low-res images and some JS <script> tags commented out.
But the author explains the steps to determine this:
1. A Cloudflare Worker checks the request object for the country a visitor is located in.
2. If a location is found, then a fetch request is made to the CO2signal API CO2signal sends back data about the current grid intensity at the visitor's location.
3. The current grid intensity is checked against the annual average grid intensity for that country (data from CO2.js).
4. If the grid intensity is equal to or greater than the annual average, then the HTML response is modified using the Cloudflare Workers HTMLRewriter. If the grid intensity is less than the annual average, the regular (unmodified) site is returned to the user.
(https://fershad.com/carbon-aware-site/)
Surely all these steps combined above use more power than just sending the unchanged HTML page to the user?
http://www.caiso.com/TodaysOutlook/Pages/emissions.html
So the data might be wrong as well which may mislead the user.
Tweeted at him here: https://x.com/edwardstarcraft/status/1695508531028566090
The only question is really step 2: How much work is required to communicate with the CO2signal API? If that API is also in a Worker and/or is able to make good use of the local Cloudflare cache then it might be quite cheap. If it has to talk to an external server somewhere then it's hard to say.
With all that said, presumably the net effect is negligible either way and the real goal is to raise awareness and demonstrate how these APIs could be used.
(disclosure: I'm the lead engineer for Cloudflare Workers.)
But to decide whether this approach works, we should first test it, improve it, and then we can benchmark it.
I find the idea interesting. Could be cached for all pages, or handled by the browser. It would be massively interesting in gaming and streaming, helping also support old devices better.
Now that I think about it, I'm wondering whether Google could change electricity prices by e.g. flipping a switch on YouTube H.264 availability in a particular region...