caker wrote:
BJI,
Just to clarify, that statement is technically inaccurate and I will make sure it gets updated. The essence of the statement is true: that
we don't over sell the machines, that there
is always $linodeRam * $numLinodes physical memory available (at least) on the hosts. This is compared to other providers using technologies like Virtuozzo, whereby they advertise "256 MB OF RAM" and a little asterisk which says "* only 8MB physical" !
Without going too deep into the details, it is technically feasible that the host's VM system will choose least used pages from a Linode "memory file" to swap, but only for the benefit of using that now-free RAM for disk cache. I trust the way the VM system does this and it hasn't been a problem, so enough said.
I want the hosts to actually HAVE swapfiles, because there are other processes that can swap, like all the "screen"/remote console processes that remain idle 99% of the time. Plus, if the hosts ever needed more memory and didn't have it, init wouldn't have to start randomly killing Linodes

Now, think about this: The host keeps pages in it's cache, just in case it needs them again. Your Linode also does the same thing. We get this double-caching effect, which is not very efficient. This is one of the things Jeff Dike (author of UML) and I have talked about, and I'm considering sponsoring the development of a better memory manager for UML.
Your Linode kernel is going to swap LRU (least recently used) pages out to swap, but those pages might stay inside the hosts's cache, so its a positive and a negative...
-Chris
Very interesting. Have you tried any testing with a system with a Linode host with no swap? I don't know what the hosts do besides run Linodes but I hope it's very little, and I can't imagine whatever a host needs to do needs much RAM. You could use ulimit on the non-Linode processes on the host to keep them from using too much memory. Let's say that you set aside 256 MB for the Linode host aside from the memory used by the Linodes themselves. Then if you turned off swap on the Linode host, and ulimited the host processes so as to guarantee (or come as close to guaranteeing as possible) that the non-Linode processes don't use more than 256 MB, then you could be sure that all of the Linode memory is kept in RAM all the time.
The reason that I propose trying this is, I really think that guaranteeing that Linode memory stays in RAM is important. I'm sure that Linux's memory management was written to be efficient in the case where fetching pages from memory actually gets them from memory. The latency that is induced by having to fetch what the Linode thinks are memory pages, from the host on the disk, might wreak havoc with Linux's memory management efficiency. It's just a guess though; I don't run user-mode Linux (except at Linode) and I don't have any way to really know. It just seems weird to me that a Linode kernel which thinks it is storing data in RAM might actually be storing it indirectly on the host disk, and vice-versa - when a Linode pages memory out to its virtual disk, it's likely that it will just be a memcopy on the actual host since the host will cache the virtual disk write in memory.
I wonder if the Linux memory management code will work alot better if RAM is always RAM and disk is always disk ... it might be better for the Linode host system performance overall.
The other thing I wonder about, is how badly it would screw all of the other Linodes on a host system if someone set up a Linode with a 256 MB root partition, and a 2 GB swap file, and ran a process that simply looped through all of its virtual memory space, touching pages ... and thus contended with other Linodes for their RAM ...