5 ms·
> The grid intensity in your location is 387 g/kWh. That's higher than average, so this site has been modified to use less power on your device. Interesting, m
by Banditoz 3y ago
> The grid intensity in your location is 387 g/kWh. That's higher than average, so this site has been modified to use less power on your device.
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/ 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?
- maigret 3y agoMight be. For sure anyone should optimize no matter what. Of course now many developers only consider the number of feature they produce or use (“shiny new library! Will fit well on my CV!”), but there is a big satisfaction of improving existing things as well. 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.
- Telemakhos 3y agoWhy not always send the smaller, simpler version, if it is functionally equivalent to the one with extra javascript and bigger images? Surely that would be simpler and save even more energy.
- jwells89 3y agoMy thoughts exactly. Maybe add a button that can load the "HD" version of a site if the user actually wants it, but I suspect for many types of sites and many users it really doesn't matter.
- EdJiang 3y agoI’m in CA and got the same notice. But I checked the grid intensity and it’s emitting 146g/KWhr. http://www.caiso.com/TodaysOutlook/Pages/emissions.html 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 https://x.com/edwardstarcraft/status/1695508531028566090
- deleted 3y ago[deleted]
- btdmaster 3y agoI thought it was measuring grid intensity in a different sense, like high/low demand for energy. (Sometimes, the grid has high demand for electricity, and other times the demand is lower, maybe even such that wholesale electricity prices are negative.) 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...
- polygot 3y agoHow much power consumption is being used for these API calls and special scripts to calculate CO2 usage?
- kentonv 3y agoAll the Workers stuff runs on a machine that your request was already going to pass through anyway, and does very little actual work compared to everything your client machine has to do to render a complex site. I would guess that part of the work is easily offset. 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.)