-2

The background of this question is stemming from an article about someone who operates a website that is powered by a solar panel and the carbon footprint that we produce in the software space. Data centers use around 2% of the world's energy. It's made me think a bit further about what I can do as an engineer to be a bit greener.

An example that comes to mind was Etsy upgrading from PHP 5 to PHP 7. With the efficiency improvements, they were able to turn off 80%+ of their app servers.

I have been a huge fan of JAMStack websites of late (where the site itself is static using something like Vue/React and all dynamic content is pulled via an API). I've also been building most of my APIs in go which is a TON more efficient than PHP/Node. I'm trying to be language agnostic here, but that's obviously a factor.

My question is then, from energy (CPU utilization?) perspective is it more efficient to generate the markup on the server, or to do so client-side. I know page caching would improve this server-side, but if these views are dyamic (logged in) then caching the page will be useless.

I know servers aren't particularly efficient at generating markup and I couldn't find any concrete answers as to what is the best from an energy perspective.

1 Answers1

2

If you don't include the client device in your energy efficiency calculation then you want to push all possible work to it.

Ideally you are only returning static information. Authentication is the only thing you need to do server side and once this is complete you can do dynamic stuff like adding the username to the top left or whatever on the client.

If you do include the client then I think its going to depend on scale.

A small site where a single low power device can respond to all the requests, then the simple cost of making each client device is going to be the overwhelming factor. If these devices can be solar powered calculators and the server can be a desktop PC then its going to be worth doing the processing on the server.

With a high volume site however the server side is going to need to be more and more high power to answer all the requests. AT some point there will be a balance where many medium power devices are better than a few high power ones

Ewan
  • 75,506