PostgreSQL as a queue - The Power and the Gory

Bask in the glory of my righteousness.

We’re all green, right? We know this is true, because the marketing people extoll it - at least, they extoll compliance (to the minimum extent required by law) with the current regulations.

I know we’re shouting into the wind on this one, your author has never met a company - multinational or local - who, when away from writing promotional materials actively gives a monkey’s about the environmental affect they’ll have. The only consideration that would be given is if it affected taxation or “optics” (in which case it’s all hands to the spin pump).

Shhh! This is “our little secret”.

If you’ve read the previous posts in this ‘PostgreSQL as a Queue’ series, you’ll have seen the broad (‘mungously so) speed differences between different languages and methods. To this end, it won’t come as a great surprise to learn that these speed efficiences (or lack thereof) show themselves again in the amount of energy required to run.

To perform what is essentially the same task, the ARM-Rust-TCP-NoPK mechanism is 60x more efficient that the Inteli5-NestJS-HTTP mechanism.

A graph showing energy consumption for the different frameworks running on a Raspberry Pi5 and a 2016 Intel Core i5

Show me the filth.

Electricity generation in the UK creates about 120gCO2/kWh (we run about a 65% renewable mix). If this was a workload for your business that ran once a day, every day, you would generate round about 60kg of CO2 with the Inteli5-NestJS-HTTP mechanism.

A graph showing CO2 generated for the different frameworks running on a Raspberry Pi5 and a 2016 Intel Core i5 once a day per year

With the most efficient mechanism, it’s 0.87kg of CO2; a ~99% reduction in your carbon emmissions. That’s a story to tell, no spin required.

What to do next?

If the day comes when BigCloud factors in electricity consumption into costs, then this topic will, like the planet, be on fire.

If you run your own data centres, then the information shown here should be of immediate interest.

You care?

If you care, there’s lots you can do - and it can seem overwhelming, but start with thinking about the systems that you have and ask questions about platforms and efficiencies. Devise representative synthetic workloads and measure their thirst. Perhaps that processing intensive task can be split out to a microservice written in a more appropriate language?

Performance doesn’t need to go hand-in-hand with vast arrays of replicated systems running at full capacity. If it does, you may have asked the wrong questions. We’ve seen it done like this and no, the customer didn’t care.

Depending upon to whom you pose your questions, you may find yourself sat outside HQ on the naughty step, clutching your CV, because you’re not going to win any friends.

LOL!

If you don’t care, sit back and relax. You’re in good company.