I'm talking to a web host that's just starting up. They have shared hosting and managed VPS's. With shared hosting I understand that they have a script checking if a process goes over memory limits and if so, the process is killed. Similarly, for their managed VPS's (CentOS-7):

... managed VPS plans are a managed service exactly like our shared hosting plans. The only difference is that you're on a VPS. We don't monitor or limit your memory usage on a VPS, so you're free to use up all of the available system memory on a VPS if you want to. That said, the kernel does have out-of-memory protection so you'd see various processes being killed off by the kernel if you start taking away memory that the kernel needs.

Wait. What about this thing called virtual memory? Is there a reason a host would want to do this?

Even for shared hosting, isn't there a way they could set ulimit -m and start paging instead of killing off a job?

Edit: I added an answer based in my own research. I'd still appreciate input.

2 Answers 2


There are certain parts of the system that can not be put I to virtual memory (swap as its called in Linux). Also, it can sometimes be prudent to have limited swap on a server depending on the disk IO performance and size. I've seen plenty systems lock up where there was (hard disk based swap).

  • Ok, so you're saying they probably have no (or limited) swap on their servers, so there is no choice but to kill the job. What about a VPS, though? Why would they set a virtual machine to have no swap? If my machine locks up, it's not going to effect anyone else.
    – Diagon
    Oct 4, 2019 at 6:14
  • 1
    I hope so (in the general case) - running a VM server and over subscribing ram is a recipe for disaster as it can cause the VMs to use swap as RAM - and that will more-or-less kill thrm.. A VPS is a VM.
    – davidgo
    Oct 4, 2019 at 8:01
  • David, I appreciate your engaging with me on this. Perhaps you'll look at my Edit in the OP where at this link, the comment is made, "you should consider a cloud service that appears like a "normal" server with swap and the like (Amazon EC2 is one such option)." Also, the distinction is made between container-based virtualization with no swap, and others like Xen, KVM et al. which "can actually be used to construct the sort of quality environment you're talking about."
    – Diagon
    Oct 4, 2019 at 8:20
  • That post is old, and I'm not sure technically accurate - unfortunately terms meanings can be different - especially "container based virtualization" which can mean things like Docker (which us not a VM or VPS ) or a number of other things. I use KVM and have swap (sparingly used) in each vm/VPS - just like I might on an EC2 instance. The trick is not to allow the HOST to put VM memery into swap. (ie don't over provision memory)
    – davidgo
    Oct 4, 2019 at 9:13
  • Ok, so that's an interesting question. I also use KVM on my home machine. What is the overhead of say of xGB provisioned for the guest VM? How many GB would that VM take up on the host machine? Is that overhead fixed, or are there things I can do in the guest that can cause it to increase?
    – Diagon
    Oct 4, 2019 at 9:28

After some research I see that this question reflects an issue that has been in peoples' craw for some time. Partitioning memory for shared hosting seems an unsolved problem (if I understand correctly). VPS's for some reason often do not have swap. Advice is "consider a cloud service that appears like a "normal" server with swap and the like (Amazon EC2 is one such option)" and furthermore, "Only container-based VPSes like OpenVZ lack swap space. Xen, KVM, VMware, etc., all allow for it, and can actually be used to construct the sort of quality environment you're talking about. OpenVZ really cannot."

  • 1
    OpenVZ's constraints do not apply to virtualization because, simply, it is not virtualization, and those VPSes are not really virtual machines. Many workloads do not run well in OpenVZ, and IMO most people should avoid it. Oct 5, 2019 at 8:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.