Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Almost all of them promise me x-MB RAM and y-MB dynamically.

I'm a programmer but I don't understand how they decide which process needs to be killed if I alloc memory and keep it for such a long time that they need to. I mean let's say a php-fcgi server instance is running up to 500MB, I don't have a problem killing it but they shouldn't kill my mysqld or lighttpd which is only started during boot time.

I couldn't find anything in the FAQ or support form of a handful of providers I checked.

share|improve this question
    
Most VPS providers don't kill processes themselves. You OS will kill processes once it fills its RAM. –  Cian Sep 6 '09 at 12:56
add comment

3 Answers

up vote 6 down vote accepted

Processes consuming too much RAM under Linux are typically killed by the kernel's oom-killer process. OOM standing for "Out Of Memory". You can read a description of the decision process that it makes here and how to influence it's behaviour here.

share|improve this answer
1  
That behavior influencing OOM is quite new. I doubt VPS providers are running new kernels –  Vinko Vrsalovic Sep 6 '09 at 19:07
add comment

Generally with hard limits like that it's the process that exceeds the limit that gets killed.

share|improve this answer
add comment

I've never used OpenVZ or Virtuozzo but this is how I understand it:

Burstable RAM is a "feature" of Virtuozzo and its open-source counterpart OpenVZ. On these boxes the individual VPSes don't actually have their own kernels running. Under these technologies each VPS has two limits in the host kernel, privvmpages and oomguarpages.

Privvmpages is set to the total amount of burstable + gauranteed RAM and processes within a VPS are allowed to allocate up to that amount of memory. When the host is running low on RAM it will begin killing processes across all of the VPS that have allocated greater than oomgaurdpages worth of RAM. Remembering that all of the VPSs on the host have all of their processes running within the same kernel makes this a bit easier to understand.

I have no real clue about how the OpenVZ/Virtuozzo OOM killer makes it's decisions about which processes to kill. If I was designing it I'd probably choose the VPS with the most pages greater than oomgaurpages and then choose a process within that VPS based on a score calculated from process age and size, rinse, repeat. Though like I said, I don't know how they really do it.

It is important to note that on a normal Linux system a process can malloc greater than the total amount of swap + RAM that exists without issue. It's when you go to use it that you are stopped. Under OpenVZ/Virtuozzo the malloc will fail. This is actually fairly common in things that would normally have lots of repeated allocations/deallocations when the process wishes to manage it's memory itself. A special purpose memory manager in such a process can have much greater performance.

share|improve this answer
    
I know about the overcommitment of Linux and i hate it. But just want to say that i think if the i would design it, i definitely would add explicit user hints either as a stay-alive-if-possible or a special kill-priority attribute. –  Lothar Sep 21 '09 at 5:53
    
Yes, that would be quite useful, good call. –  mikegrb Sep 23 '09 at 12:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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