carbonalyser/Carbonalyser

Taking browser/server cache into account

fm89 opened this issue · 2 comments

fm89 commented

Thanks for this project. I was looking for such a tool. However, it looks like Carbonalyser does not properly take caching into account.

Concerning my Internet browsing, this results in wrong orders of magnitude for the importance of different websites. Indeed, when browsing on, say GitHub all day long, CSS, JS or image assets are loaded only once (and not 100 or 1000 times per day).

There are (at least) two situations that need to be handled correctly:

  1. The browser does not send the query to the server, but loads the resource from it's own cache. This should not count in "data center" and "data transfer" kWh or CO2 costs.
  2. The brower sends a request but the server returns an HTTP 304 (resource not modified) status code. Then there is a request but only of very small size. The full size of the resource should not count in "data center" and "data transfer" kWh or CO2 costs since it is loaded from cache and only a very small query was made.

Thanks @fm89 I will take a look. If you are a js developer, feel free to contribute to the code !

we are 2021 things are a little bit more complicated because we got RCWN feature in browsers https://superuser.com/questions/1630514/how-to-disable-race-cache-with-network-rcwn-in-firefox.

So even if the request even if the request have been served from cache we may consider that the data have been sent over wire.

It thing we should close this issue as it is not technically feasible at the time and reopen it later if the feature RCWN disapear