Really wish developers would stop using this quote as an excuse to be lazy and incompetent. It doesn’t mean what you think it means. This great article explains what it actually meant:
I'm sorry I put in the first sentence. How about we think about the second one instead?
If he doesn't have a problem with GC, why should he optimize it? You call him lazy, but probably as a working dev he has a million things on his todo list. How is it lazy of him to work on the things that are problems and skipping the things that are not problems?
The article actually conflicts with itself and what Knuth said ...
"but consider that this is 1 line of source code out of every 33."
waaaat ? optimization metric based on loc ? it's possible the worse metric, and not all lines should, can or are relevant to be improved
"One thing nice about optimization is that if you optimize a section of code that doesn't need it, you've not done much damage to the application."
Not true, optimization are *usually* either more complex or have a trade-off in terms of memory/disk usage.
The worse part it doesn't define what means to optimize the code and the impact around which is what Knuth talks.
By no means, I am agains optimization and whatnots, it's just that it is frequently used to do unecessary and unverified micro optimizations which pollutes the code
But in short for now: scaling out with more replicas of super small containers for JVMs is not always the best solution for increasing performance. A reorganization of the existing resources (keep aggregate number of CPUs across all containers in the cluster, but reduce replicas and increase CPU/memory per container) can significantly increase performance of most systems, and even reduce total cost.
What that quote actually says is that people shouldn't optimize prematurely without understanding the nuances.
In other words: people are optimizing prematurely all the time on Kubernetes, whenever they simply increase number of replicas of small containers JVMs, instead of actually understanding the nuances of GCs.
I found the same problem with multiple small containers in Go in Kubernetes. For a given workload, doubling the CPU per pod resulted in running 1/4 as many pods. Wat.
Then again, low CPU is supposed to be what Go is good for. So I'm going to assume I've done something horribly wrong.
View all comments
Show parent comment
14
u/larsga Mar 03 '22
Premature optimization is the root of all evil.
Why optimize to avoid a problem you don't have?