How to optimize your Microservice Architecture for sustainability
As of today, the important topic in businesses is sustainability. Well, yes but what are we speaking mostly? The longer we keep the lights on or the water running, the more resources we consume. That only means a bigger carbon footprint? The answer is no, It’s the same for running the software with high compute power. The more computing power and digital storage we need, the more electricity we use.
We should acknowledge and accept there is a problem. IT is a large and growing part of global warming problem; by 2030 it’s predicted that 21% of all the energy consumed in the world will be by IT. Energy that is still, for the vast majority, generated from fossil fuels. The internet accounts for 3.7% of global carbon emissions; slightly more than aviation, and we all know we need to fly less… but what will do for IT? Will consider stopping building or using, the technology? Obviously no, as it is part of the growth and requirement.
Same time, we shouldn’t take it light; we are requesting you, consider green engineering principles while you’re building or versioning an API. Also, when you are breaking down a monolith into microservices, minimize the microservice traffic. Remove unnecessary network hops. Bring this up in decision sessions and architecture review boards. Educate your colleagues, do more of your own research. Just please don’t read this, agree with it, and then continue doing everything exactly as before.
In this post let’s check how we can apply the principles of green software to optimize our microservice architecture for sustainability. Why should give more attention to microservices architecture? here is the stat explains the adoption to microservices.
Before we check it further, here are some terms used in this post.
- Carbon: Build applications that are carbon efficient.
- Electricity: Build applications that are energy efficient.
- Carbon Intensity: Consume electricity with the lowest carbon intensity.
- Embodied Carbon: Build applications that are hardware efficient.
- Energy Proportionality: Maximize the energy efficiency of hardware.
- Networking: Reduce the amount of data and distance it must travel across the network.
- Demand Shaping: Build carbon-aware applications.
- Measurement & Optimization: Focus on step-by-step optimizations that increase the overall carbon efficiency.
What is Microservices?
Microservices — also known as the microservice architecture — is an architectural style that structures an application as a collection of services that are.
- Independently deployable
- Loosely coupled.
- Organized around business capabilities.
- Owned by a small team.
- Highly maintainable and testable
The microservice architecture enables the rapid, frequent and reliable delivery of large, complex applications. It also enables an organization to evolve its technology stack.
When we speak about microservice architecture, we should focus on following things,
- Compute
- Count of microservices
- Database
- Latency
- Network
Let’s check one by one how to optimize.
Increase your compute utilization.
Increase your workload distribution and compute resources so that you use less resources at a higher utilization. How this helps, well, with high limit, it reduces the amount of energy your compute-resources spend in an idle state.
- If using virtual machines for compute resources and they have low utilization, consider reducing the size of those virtual machines to increase utilization. Smaller virtual machines with higher utilization usually use less energy than larger virtual machines with lower utilization given the same workload.
- Evaluate migrating your workload to a PaaS wherever possible. Typically, PaaS solutions are sized more appropriately for their workload and it can run those workloads at a high utilization on their underlying compute resources.
- Consider using auto-scaling or burst capabilities for your compute-resources over statically allocating compute resources for maximum capacity at all times. These capabilities allow you to increase and decrease your compute-resources based on demand while keeping the utilization high on those compute resources.
- If you have many logical layers in a physical tier, consider increasing your physical tiers and reorganizing where your logical layers run. The increased physical tiers with a more granular organization of logical layers allows you more flexibility to scale the logical layers independently. This flexibility allows you to keep utilization high on your compute-resources and avoid idle logical layers.
Continue reading on How to optimize your Microservice Architecture for sustainability (foxutech.com)