Self-confessed performance nerd; I have been a general performance engineer for my whole working life! If I carry on, I might start to understand some of it.
I work as a consultant for Capacitas helping improve performance and save cloud costs.
If you like the cartoons or want to see my posts follow me on LinkedIn.
Every line of code has a cost – but some lines cost more than others. This rather Orwellian-sounding statement might seem stark, but for web performance engineers, it’s a useful perspective when considering cloud costs.
Why Should You Care About Costs?
Cost reduction directly impacts the bottom line. Money saved can be reinvested into meaningful initiatives, like company retreats or innovative projects – or for those with stock options, boosting EBITDA. Additionally, efficient resource usage reduces the environmental footprint of your application, earning approval from polar bears everywhere.
So, how can we design systems and software that are cost-efficient in the cloud – Let’s explore the four “buckets” of cost savings.
Bucket 1: Billing
Depending on your organization, you might never see the cloud bill. Hopefully, your company is leveraging discounts for committed spend, but is it ensuring you’re only paying for what you use?
For instance, consider a disk you provisioned during design. You might have chosen one with high IOPS (input/output operations per second) to handle expected demand. But after going live, you realize the disk’s capabilities are underutilized. Cloud providers rarely inform you that you could save money by downgrading to a more cost-effective option. This adjustment can be made directly in the console without any downtime.
Billing optimization tools can help here. They analyze usage patterns and recommend savings opportunities based on real-world data. If you’re not involved in discussions about cloud costs, it might be a sign that your organization isn’t very cost-aware.
Understanding the billing and costing model allows you to make appropriate choices when it comes to technology and services. For example have you considered using Graviton-based servers as they often provide greater cost performance?
Bucket 2: Wastage
Wastage refers to paying for resources you don’t use. A common example is forgetting to turn off idle development environments or unused instances.
The more complex side of waste reduction involves running resources at optimal capacity. To achieve this, you need to understand the Utilization Sweet Spot. According to queuing theory, response times degrade significantly when utilization exceeds ~80%. This “knee of the curve” is a helpful benchmark: if servers or databases are running at 30% utilization during peak times, you’ve oversized them.
By analyzing usage trends and downsizing where appropriate, you can cut costs. Be aware that the 80% rule is a generalisation and may not apply to your particular environment but in general it is a great rule of thumb. Additionally, the cloud’s flexibility lets you scale resources dynamically – plan for Black Friday, but slim down in the off-season.
Consider auto scaling. Auto scaling increases compute power as workload demands grow and shrinks it back when demand drops. It’s especially useful in containerized environments. However, simply deploying to containers doesn’t guarantee optimal efficiency. You need to configure request limits and scale-up/scale-down parameters for worker nodes appropriately.
Bucket 3: Efficiency
Once your resources are fully utilized, the next step is to ensure they’re being used efficiently.
Efficient code generally uses fewer resources, translating to lower costs. The fewer CPU cycles, memory, and I/O your code consumes, the better. However, there are trade-offs. For example, caching can improve speed but might increase memory usage. Balancing these trade-offs requires careful consideration.
Beware of Performance Tricks that waste resources. For instance, speculative loading improves speed by preloading the next item in the background. But if that item isn’t used, the preloading effort is wasted.
Maybe consider how offloading processing to the user’s browser can reduce server costs, provided the delivery of code to the browser isn’t excessive. However, this approach relies on a mix of user devices and environments, so test thoroughly.
Bucket 4: Effectiveness – Are You Doing the Right Stuff?
This bucket focuses on eliminating wasteful or unnecessary tasks. Ask yourself: “Is this really worth it?”
Beware of Killer Features Nobody Cares About. For instance, a company implemented a “reach score” for users to encourage engagement. It consumed 25% of a database’s resources but yielded no measurable impact on behaviour (discovered with A/B testing). By removing this feature, they significantly reduced costs without affecting user experience.
Prevent misuse of features as well. For example, a CSV export function designed for occasional use might be exploited for large-scale data extraction by users populating their own data stores, inflating costs. Implementing fair-use policies can mitigate such scenarios.
Effectiveness is about cutting the fluff. If a feature doesn’t benefit users or your bottom line, consider eliminating it. Sometimes, the most cost-saving line of code is the one you don’t write.
Summary
As a web performance engineer, your primary goal is speed and responsiveness. Cost considerations shouldn’t compromise user experience. Instead, aim for efficiency: optimize where it adds meaningful value and avoid costly techniques with minimal benefits.
By focusing on the four buckets – billing, wastage, efficiency, and effectiveness – you can create cloud-based applications that are both high-performing and cost-efficient.
Good luck on your journey to better cloud cost management!