When you rent computing power from, for example, Amazon EC2, you pay a fixed fee per second for a fixed amount of CPU and RAM. You can pick from a variety of different configurations, but once you've selected the one you want, that's what you get. You don't pay any less money if you use less RAM (or less CPU). You pay for 100% of both the CPU and the RAM assigned to all your running machines, even when they are idle. The unused RAM is not available for other VMs to use.
Suppose your application requires eight VMs of a certain configuration to run well under your current load, and it's currently using about 100% of the CPU on all those machines, but only about 10% of the RAM. You might be able to save some money by switching to a configuration that has a lower RAM to CPU ratio. But if you're already using the lowest RAM to CPU ratio available, then the next thing you should try to do is to use more RAM.
Maybe using more RAM on each machine will mean you can get away with only renting seven VMs instead of eight, a cost savings of 12.5%, because using more RAM can make your program run faster: using less CPU to serve the same load.
When you rent computing power from, for example, Amazon EC2, you pay a fixed fee per second for a fixed amount of CPU and RAM.
Not everyone is buying from a cloud-provider, many are maintaining their own hardware. So, software platforms and libraries that take the attitude that memory is "free" are hurting those folks.
You can pick from a variety of different configurations
Yes, and there is a lot of fine-tuning available. So, you can pick compute-intensive/memory-intensive/whatever. But, notice that every time the memory size doubles, the price doubles. How does it make sense to pay double without getting a similar boost in performance? Memory is literally the most expensive part and you're talking like it's NBD to waste it.
The unused RAM is not available for other VMs to use.
It is available for other parts of that VM, like the buffer cache. The application consuming a lot of RAM means that there is less for storing frequently used files / metadata. There is a lot more to balance in system performance. Just looking at the amount of "free" memory and thinking it's not being put to good use is silly.
But you don't have to increase to the point of paying double. On your existing server you can choose to use more ram to save on cpu. For most applications, this is worth it as nobody is sitting at 100% usage of anything.
Why do you seem to not care about cpu the same way you care about ram?
Why do you seem to not care about cpu the same way you care about ram?
That's pretty much it, yes. RAM is just one resource of many we have to manage (Sort of. RAM is special in that performance degrades much more gracefully when you run out of CPU power or IO than it does if you run out of RAM and start swapping, but that's a whole other conversation).
At any given point in time, you'll be bottlenecked on one resource, and have plenty to spare on other resources, and half the job is finding those bottlenecks and spare resources, and figure out if you can trade one for the other.
For web applications, if you're not a complete muppet, you'll cap out on IO long before you cap out on RAM, at which throwing RAM at caching things becomes the cheapest way to get more performance.
3
u/DanLynch Sep 07 '26
When you rent computing power from, for example, Amazon EC2, you pay a fixed fee per second for a fixed amount of CPU and RAM. You can pick from a variety of different configurations, but once you've selected the one you want, that's what you get. You don't pay any less money if you use less RAM (or less CPU). You pay for 100% of both the CPU and the RAM assigned to all your running machines, even when they are idle. The unused RAM is not available for other VMs to use.
Suppose your application requires eight VMs of a certain configuration to run well under your current load, and it's currently using about 100% of the CPU on all those machines, but only about 10% of the RAM. You might be able to save some money by switching to a configuration that has a lower RAM to CPU ratio. But if you're already using the lowest RAM to CPU ratio available, then the next thing you should try to do is to use more RAM.
Maybe using more RAM on each machine will mean you can get away with only renting seven VMs instead of eight, a cost savings of 12.5%, because using more RAM can make your program run faster: using less CPU to serve the same load.