5 ms·
Only if you have burst of requests that need to be replied with constant latency and therefore want to avoid any risk of having to read back swapped out memory.
by goodpoint 2y ago
Only if you have burst of requests that need to be replied with constant latency and therefore want to avoid any risk of having to read back swapped out memory.
It's a very rare corner case.
- shermantanktop 2y agoIf you are running a fleet of thousands of hosts in an environment with auto-scaling capabilities, your swap will never do anything except under extraordinary burst load, e.g. DDOS. In that situation, swap provides exactly the wrong thing - it attempts to keep up with memory demand by doing a more expensive and slower version of regular processing. That’s a key ingredient in the recipe for congestion collapse.
- skywhopper 2y agoDepends on the workload characteristics. If there’s a chance one request could balloon into a huge RAM consumer, you want to be able to survive that without running out of RAM. But if you are hitting swap regularly across your fleet, it’s time to tweak your scaling parameters. But if you never ever hit it, you may be overscaled.
- goodpoint 2y agoThank you!
- littlestymaar 2y agoSure swap isn't helping, but having random processes being OOM-killed isn't either …
- deleted 2y ago[deleted]
- JackSlateur 2y agoIt does, if it helps you highlight an issue somewhere : sizing, rate limiting or whatever
- goodpoint 2y agoIf you are relying on failures and crashes instead of proactively monitor your workload you are already taking the wrong approach, swap or no swap.
- shermantanktop 2y agoYeah, but shit happens. Oom killer and the load balancer ejecting the host is better than 0.03% of requests mysteriously failing for weeks.
- toast0 2y agoDepends on how much swap you have. If you have a little (0.5-1 GB), you'll catch the extraordinary bursts that are handleable, without getting to the trashes to hard to finally die. And you have a handy dandy thing to monitor to show when you're actually under memory pressure.
- littlestymaar 2y agoIf you need constant latency you already need to avoid allocation altogether after the start of the program (among other things) so swapping should never occur in the first place.
- goodpoint 2y ago> swapping should never occur in the first place No. 99.9% of servers are running more processes than the main workload. There are all sorts of security, monitoring, auditing, inventory tools that might run occasionally. As I wrote, it's a rare corner case.
- kbolino 2y agoOn servers, unless you have a very fast SSD dedicated to swap, all swap gets you is waiting an extra long time to figure out that the operation you're trying to do is going to fail anyway. The number of tasks that need just a little more RAM after exhausting the dozens to thousands of gigabytes modern computers have are vanishingly few.
- littlestymaar 2y ago> the dozens to thousands of gigabytes modern computers have Hello time traveler, what year do you live in to have regular servers with “dozens of thousands” of GB…
- kbolino 2y ago"to" not "of" Though if you have $400/hour to spend, you can get an u7in-32tb.224xlarge in AWS us-east-1 region.
- goodpoint 2y ago> all swap gets you is waiting an extra long time to figure out that the operation you're trying to do is going to fail anyway No, it gives you progressive performance degradation instead of a hard failure and this is a feature and not a bug.