New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Comments
If the provider allows it you can manualy add swap, for an linux vps you can use this guide:
thanks, is it common to disallow in the terms? or do most not really care
Good question, never saw it mentioned in the terms, I'm assuming that the providers limit the iops of the disk to prevent some kind of iops abuse, so even if you configure a swap I don't see it as a possible violation.
I've not heard of a provider disallowing you to set your own swap, though I wouldn't rely on it for anything other than a safe buffer. If you're hitting your swap space constantly, find out why and optimize if able or upgrade to more actual ram if needed.
A lot of OSs will create SWAP upon installation with a low RAM capacity. Never heard of it being disallowed.
Here's how you could create a 2GB SWAP file:
If you want this to be permanent, then in your /etc/fstab file add this:
/swapfile swap swap defaults 0 0
You will now have a 2GB SWAP set up and running.
If you want to turn off the swap, then you can issue:
swapoff -a
This will work on any KVM or Dedicated Server. I'm not sure this will work for LXC or VZ containers though.
Works for LXC.
Will not work for openVZ.
EDIT: I did not know that it would work for LXC, going to try it now
EDIT2: Nope did not work on LXC.
Most probably won’t work with LXC. And SWAP is not RAM, so get a larger plan if resources are tight.
I'd only suggest adding SWAP if you have a very specific need to.
use case is, I have a KVM 4GB, running nginx reverse proxy, wireguard with 5 peers, 2 wordpress, all in docker containers. the ram usage never goes above 2GB so was thinking to get a smaller 2GB VPS, with NVMe and add 2GB swap just in case it ever goes over 2GB. just thinking to save a couple of euros
You are correct it did not work with LXC.
There are good uses and bad uses of swap. If swapping causes consistent load it can cause issues for the provider and you, if no load it's not a problem for anyone.
As an example I have mail servers that are 2GB Ram 1GB swap.
The swap only gets used during virus scanner updates three times a day for maybe a
minute, if no swap it goes oom. I would consider this a good use for swap.
On a web server I personally go by the rule that I never want to have a consistent normal RAM use over 60% to allow for peaks in usage. But that is just me.
My bad.
swapon: /swapfile: swapon failed: Operation not permitted
LXC.