3 ms·
> So, in other words, if you have enough memory for your workload that you won't run out, there's no benefit to having swap space (i.e. you've wasted money on m
by Anderkent 9y ago
> So, in other words, if you have enough memory for your workload that you won't run out, there's no benefit to having swap space (i.e. you've wasted money on memory you don't need).
No, that's the opposite. If you have enough memory for your workload that you won't run out, swapping lets you use more memory for disk cache (instead of keeping unaccessed anonymous pages in real ram).
Unless by "won't run out" you mean "never have to throw away a disk cache page", which seems very unrealistic.
- clarry 9y ago> If you have enough memory for your workload that you won't run out, swapping lets you use more memory for disk cache Except that it doesn't happen in practice, on my systems anyway. If you have plenty of memory, you can keep all your programs in it and as much as the system wants to cache and still not run out. The theory says that swap effectively buys you some memory to spend on more important things (than what the system chooses to page out). So does buying more memory. > Unless by "won't run out" you mean "never have to throw away a disk cache page", which seems very unrealistic. I have an instance of top running on my desktops & laptops all the time. I never see cache using up all of the memory. total used free shared buff/cache available Mem: 7848 1523 5827 53 497 6033
- Anderkent 9y agoAre you talking desktop workflows here? If this is a service, why are you paying for RAM that never gets used? Get a smaller instance.
- clarry 9y ago> Are you talking desktop workflows here? Yes [I explicitly spelled out desktops & laptops] but it's been true on my servers too. > If this is a service, why are you paying for RAM that never gets used? Get a smaller instance. Not all providers are so flexible. I may want a server with more CPU & traffic and some additional disk space. Going there gets me more RAM too. It turns out these services are constrained by the real hardware. If I'm getting a box with enough CPU for my needs, well they are not going to a shop to buy that special box for me, they use what they have and what they have comes with plenty of RAM too.