Maintainability Over Performance
A common issue in software development is to use complicated system design (e.g., multiple levels of caching) or optimize the code (e.g., bypass middleware, use low-level functions) at the expense of maintainability. The argument for such optimization generally takes two forms:
cost: “this optimization makes us save so much on infrastructure”
performance: “our product is the fastest on the market”
The cost argument is a fallacy. Infrastructure costs (e.g., paying for a datacenter or for a cloud provider) are way cheaper than the cost of writing and maintaining software (e.g., engineers’ salaries). If an optimization makes the system harder to understand (and it almost always does), it will cost more in engineers’ time to read and understand it but also will be more prone to error and create bugs or incidents. In other words, an “optimization” is very likely to cost more in maintenance than it saves in infrastructure.
The second argument is also misguided. If you need to run software faster, throw more money at the problem. Spend more on infrastructure (e.g., get faster CPUs). Infrastructure costs (e.g., CPU, memory) go down over time while labor costs (e.g., developer salary) continues to go up — this makes any optimization pricier over time.
What we should constantly optimize for, then? Maintainability and Simplicity.
The maintenance represents 60%-80% of the total cost of ownership for any piece of software. In other words, more than 50% of your software operational cost is dedicated to maintenance (fixing bugs, adapting features to customers, resolving incidents, etc.).
To lower maintenance cost, the system design and implementation must be as simple as possible.
A simple system is easy to understand, modify and operate. New engineers onboard faster on a simple system. When code is easy to understand, iteration loops are shorter and any fix is shipped faster. Engineers understand and update the system faster when on call, reducing both team stress and customers’ frustration.
In other words, a simple system is easy to operate and maintain.
Simple system = lower cost of ownership = save cost or spend on something else
Simple system = fewer and shorter bugs and incidents = happy customers
By making your design and code simple, your customers, and development teams are happy. And this matters more than an unnoticeable gain of a few microseconds of latency.
Note: optimization should still occur in some very specific cases (generally low-level software) — this is the exception, not the rule.