0

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.

Diagon
  • 236
  • 1
  • 10

2 Answers2

0

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).

davidgo
  • 5,964
  • 2
  • 21
  • 38
  • 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 04 '19 at 06: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 04 '19 at 08:01
  • David, I appreciate your engaging with me on this. Perhaps you'll look at my **Edit** in the OP where at [this link](https://serverfault.com/a/469451/206680), 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 04 '19 at 08: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 04 '19 at 09: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 04 '19 at 09:28
  • I'm **exactly** sure, but I've not run into problems allocating enough (memory) for a minimal Linux system - eg 250megs for the host + adequate memory for each client such sum if memory for host+clients <= total memory. I looked after a fair number of VM servers. – davidgo Oct 04 '19 at 18:21
0

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."

Diagon
  • 236
  • 1
  • 10
  • 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. – Michael Hampton Oct 05 '19 at 08:33