* Memory under KVM? @ 2009-12-11 21:43 rek2 2009-12-11 22:54 ` Brian Jackson 2009-12-12 8:09 ` Avi Kivity 0 siblings, 2 replies; 21+ messages in thread From: rek2 @ 2009-12-11 21:43 UTC (permalink / raw) To: kvm Hi everyone, I'm new to the list and I have a couple questions that we are wondering about here at work... we have notice that the KVM processes on the host take much more memory than the memory we have told the VM to use.. a ruff example.. if we tell KVM to use 2 gigs for one VM it will end up showing on the host process list for that VM like 3 gigs or more... Why do I ask this? well we need to figure out how much memory to add to our host server so we can calculate the number of VM's we can run there etc etc.. Thanks for the help ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-11 21:43 Memory under KVM? rek2 @ 2009-12-11 22:54 ` Brian Jackson 2009-12-12 8:09 ` Avi Kivity 1 sibling, 0 replies; 21+ messages in thread From: Brian Jackson @ 2009-12-11 22:54 UTC (permalink / raw) To: rek2; +Cc: kvm On Friday 11 December 2009 15:43:01 rek2 wrote: > Hi everyone, I'm new to the list and I have a couple questions that we > are wondering about here at work... > we have notice that the KVM processes on the host take much more memory > than the memory we have told the VM to use.. a ruff example.. > if we tell KVM to use 2 gigs for one VM it will end up showing on the > host process list for that VM like 3 gigs or more... > Why do I ask this? well we need to figure out how much memory to add to > our host server so we can calculate the number of VM's we can run there > etc etc.. > > Thanks for the help > My guests' RES size are all either right at or below what the -m parameter is set to. So I think you have some sort of issue. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-11 21:43 Memory under KVM? rek2 2009-12-11 22:54 ` Brian Jackson @ 2009-12-12 8:09 ` Avi Kivity 2009-12-12 20:37 ` Thomas Fjellstrom 1 sibling, 1 reply; 21+ messages in thread From: Avi Kivity @ 2009-12-12 8:09 UTC (permalink / raw) To: rek2; +Cc: kvm On 12/11/2009 11:43 PM, rek2 wrote: > Hi everyone, I'm new to the list and I have a couple questions that we > are wondering about here at work... > we have notice that the KVM processes on the host take much more > memory than the memory we have told the VM to use.. a ruff example.. > if we tell KVM to use 2 gigs for one VM it will end up showing on the > host process list for that VM like 3 gigs or more... > Why do I ask this? well we need to figure out how much memory to add > to our host server so we can calculate the number of VM's we can run > there etc etc.. Can you give an example? A snapshot from 'top' would do. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-12 8:09 ` Avi Kivity @ 2009-12-12 20:37 ` Thomas Fjellstrom 2009-12-13 10:08 ` Avi Kivity 0 siblings, 1 reply; 21+ messages in thread From: Thomas Fjellstrom @ 2009-12-12 20:37 UTC (permalink / raw) To: kvm On Sat December 12 2009, Avi Kivity wrote: > On 12/11/2009 11:43 PM, rek2 wrote: > > Hi everyone, I'm new to the list and I have a couple questions that we > > are wondering about here at work... > > we have notice that the KVM processes on the host take much more > > memory than the memory we have told the VM to use.. a ruff example.. > > if we tell KVM to use 2 gigs for one VM it will end up showing on the > > host process list for that VM like 3 gigs or more... > > Why do I ask this? well we need to figure out how much memory to add > > to our host server so we can calculate the number of VM's we can run > > there etc etc.. > > Can you give an example? A snapshot from 'top' would do. > I have the opposite happen, when a VM is started, RES is usually lower than -m, which I find slightly odd. But makes sense if qemu/kvm don't actually allocate memory from the host till its requested the first time (if only it would return some of it afterwards, it would be even better). I just fully shut down and restarted on of my vms, which is set to use 128-256 MB ram max. RES is like 72MB on start, and VIRT is 454M. RES generally gets up around 120MB ram when its doing something. One thing I do find a little odd is one of my VMs which is allocated 512MB ram, has a VIRT of 826MB ram. I didn't realize that qemu had so many lib dependencies. Due to kvm not supporting giving memory back, besides by swapping large portions of unused guest ram, my host currently has over 1G used swap. Not particularly happy with that, but it doesn't seem to effect performance too much (except that it generally likes to swap host processes first, guest performance is decent, but host, not so much). -- Thomas Fjellstrom tfjellstrom@shaw.ca ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-12 20:37 ` Thomas Fjellstrom @ 2009-12-13 10:08 ` Avi Kivity 2009-12-13 16:41 ` Thomas Fjellstrom 0 siblings, 1 reply; 21+ messages in thread From: Avi Kivity @ 2009-12-13 10:08 UTC (permalink / raw) To: tfjellstrom; +Cc: kvm On 12/12/2009 10:37 PM, Thomas Fjellstrom wrote: > > I have the opposite happen, when a VM is started, RES is usually lower than > -m, which I find slightly odd. But makes sense if qemu/kvm don't actually > allocate memory from the host till its requested the first time That is the case. > (if only it > would return some of it afterwards, it would be even better). > Use the balloon driver to return memory to the host. > I just fully shut down and restarted on of my vms, which is set to use > 128-256 MB ram max. RES is like 72MB on start, and VIRT is 454M. RES > generally gets up around 120MB ram when its doing something. > > One thing I do find a little odd is one of my VMs which is allocated 512MB > ram, has a VIRT of 826MB ram. I didn't realize that qemu had so many lib > dependencies. It's not just libraries, it's mostly glibc malloc() allocating huge pools per thread, as well as large thread stacks. > Due to kvm not supporting giving memory back, besides by > swapping large portions of unused guest ram, my host currently has over 1G > used swap. Not particularly happy with that, but it doesn't seem to effect > performance too much (except that it generally likes to swap host processes > first, guest performance is decent, but host, not so much). > The Linux vm prefers anonymous memory, so guests do get an advantage. -- error compiling committee.c: too many arguments to function ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-13 10:08 ` Avi Kivity @ 2009-12-13 16:41 ` Thomas Fjellstrom 2009-12-13 16:45 ` Avi Kivity 2009-12-13 20:23 ` rek2 0 siblings, 2 replies; 21+ messages in thread From: Thomas Fjellstrom @ 2009-12-13 16:41 UTC (permalink / raw) To: kvm; +Cc: Avi Kivity On Sun December 13 2009, Avi Kivity wrote: > On 12/12/2009 10:37 PM, Thomas Fjellstrom wrote: > > I have the opposite happen, when a VM is started, RES is usually lower > > than -m, which I find slightly odd. But makes sense if qemu/kvm don't > > actually allocate memory from the host till its requested the first > > time > > That is the case. > > > (if only it > > would return some of it afterwards, it would be even better). > > Use the balloon driver to return memory to the host. Will it actually just free the memory and leave the total memory size in the VM alone? Last I checked it would just decrease the total memory size, which isn't that useful. Sometimes it needs more ram, so its given 512M ram, but most of the time can live on 100M or so. > > I just fully shut down and restarted on of my vms, which is set to use > > 128-256 MB ram max. RES is like 72MB on start, and VIRT is 454M. RES > > generally gets up around 120MB ram when its doing something. > > > > One thing I do find a little odd is one of my VMs which is allocated > > 512MB ram, has a VIRT of 826MB ram. I didn't realize that qemu had so > > many lib dependencies. > > It's not just libraries, it's mostly glibc malloc() allocating huge > pools per thread, as well as large thread stacks. > > > Due to kvm not supporting giving memory back, besides by > > swapping large portions of unused guest ram, my host currently has over > > 1G used swap. Not particularly happy with that, but it doesn't seem to > > effect performance too much (except that it generally likes to swap > > host processes first, guest performance is decent, but host, not so > > much). > > The Linux vm prefers anonymous memory, so guests do get an advantage. > I think the only thing I'd like to have now is automatic memory return, much like vmware server has. It doesn't change what the guest VM sees, it just flushes the unused ram back to the host. -- Thomas Fjellstrom tfjellstrom@shaw.ca ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-13 16:41 ` Thomas Fjellstrom @ 2009-12-13 16:45 ` Avi Kivity 2009-12-13 17:16 ` Thomas Fjellstrom 2009-12-13 20:23 ` rek2 1 sibling, 1 reply; 21+ messages in thread From: Avi Kivity @ 2009-12-13 16:45 UTC (permalink / raw) To: tfjellstrom; +Cc: kvm On 12/13/2009 06:41 PM, Thomas Fjellstrom wrote: > >> Use the balloon driver to return memory to the host. >> > Will it actually just free the memory and leave the total memory size in the > VM alone? Last I checked it would just decrease the total memory size, which > isn't that useful. Sometimes it needs more ram, so its given 512M ram, but > most of the time can live on 100M or so. > If you balloon and than balloon back the guest will be able to reallocate all this memory. >> The Linux vm prefers anonymous memory, so guests do get an advantage. >> >> > I think the only thing I'd like to have now is automatic memory return, much > like vmware server has. It doesn't change what the guest VM sees, it just > flushes the unused ram back to the host. > Linux usually keeps very little RAM free (it's kept as cache). So there has to be some action on the part of the host to get the guest to free things. For Windows guests you can use ksm to reclaim free memory (since Windows will zero it). -- error compiling committee.c: too many arguments to function ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-13 16:45 ` Avi Kivity @ 2009-12-13 17:16 ` Thomas Fjellstrom 2009-12-15 10:06 ` Avi Kivity 0 siblings, 1 reply; 21+ messages in thread From: Thomas Fjellstrom @ 2009-12-13 17:16 UTC (permalink / raw) To: kvm; +Cc: Avi Kivity On Sun December 13 2009, Avi Kivity wrote: > On 12/13/2009 06:41 PM, Thomas Fjellstrom wrote: > >> Use the balloon driver to return memory to the host. > > > > Will it actually just free the memory and leave the total memory size > > in the VM alone? Last I checked it would just decrease the total memory > > size, which isn't that useful. Sometimes it needs more ram, so its > > given 512M ram, but most of the time can live on 100M or so. > > If you balloon and than balloon back the guest will be able to > reallocate all this memory. > > >> The Linux vm prefers anonymous memory, so guests do get an advantage. > > > > I think the only thing I'd like to have now is automatic memory return, > > much like vmware server has. It doesn't change what the guest VM sees, > > it just flushes the unused ram back to the host. > > Linux usually keeps very little RAM free (it's kept as cache). So there > has to be some action on the part of the host to get the guest to free > things. For Windows guests you can use ksm to reclaim free memory > (since Windows will zero it). > I'm waiting for 2.6.32 to hit Debian Sid before I start playing with ksm (I don't think its in 2.6.31). The problem is it should be automatic. The balloon driver itself or some other mechanism should be capable of noticing when it can free up a bunch of guest memory. I can't be bothered to manually sit around and monitor memory usage on my host so I can then go into virt-manager to reduce memory to each guest. What vmware server had worked great. After some time (quite a lot usually) something would flush the cache, and return most of the unused guest ram back to the host. Also, I don't have any windows guests atm. just 2 BSDs and 5 linux guests. I've had to do some tweaking guest side to cut down on ram (reduce apache, mysql, nginx and other services threads/forks). Something that wasn't necessary at all with vmware server. As I said before, that last feature is pretty much the last thing that would make KVM perfect for my purposes. that is, returning guest memory without actually changing the allocation in the guest. -- Thomas Fjellstrom tfjellstrom@shaw.ca ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-13 17:16 ` Thomas Fjellstrom @ 2009-12-15 10:06 ` Avi Kivity 2009-12-15 23:21 ` Thomas Fjellstrom 0 siblings, 1 reply; 21+ messages in thread From: Avi Kivity @ 2009-12-15 10:06 UTC (permalink / raw) To: tfjellstrom; +Cc: kvm On 12/13/2009 07:16 PM, Thomas Fjellstrom wrote: > >> Linux usually keeps very little RAM free (it's kept as cache). So there >> has to be some action on the part of the host to get the guest to free >> things. For Windows guests you can use ksm to reclaim free memory >> (since Windows will zero it). >> >> > I'm waiting for 2.6.32 to hit Debian Sid before I start playing with ksm (I > don't think its in 2.6.31). > > The problem is it should be automatic. The balloon driver itself or some > other mechanism should be capable of noticing when it can free up a bunch of > guest memory. I can't be bothered to manually sit around and monitor memory > usage on my host so I can then go into virt-manager to reduce memory to each > guest. > That should be pretty easy though it will have an effect on guest performance. -- error compiling committee.c: too many arguments to function ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-15 10:06 ` Avi Kivity @ 2009-12-15 23:21 ` Thomas Fjellstrom 2009-12-16 9:55 ` Avi Kivity 0 siblings, 1 reply; 21+ messages in thread From: Thomas Fjellstrom @ 2009-12-15 23:21 UTC (permalink / raw) To: kvm; +Cc: Avi Kivity On Tue December 15 2009, Avi Kivity wrote: > On 12/13/2009 07:16 PM, Thomas Fjellstrom wrote: > >> Linux usually keeps very little RAM free (it's kept as cache). So > >> there has to be some action on the part of the host to get the guest > >> to free things. For Windows guests you can use ksm to reclaim free > >> memory (since Windows will zero it). > > > > I'm waiting for 2.6.32 to hit Debian Sid before I start playing with > > ksm (I don't think its in 2.6.31). > > > > The problem is it should be automatic. The balloon driver itself or > > some other mechanism should be capable of noticing when it can free up > > a bunch of guest memory. I can't be bothered to manually sit around and > > monitor memory usage on my host so I can then go into virt-manager to > > reduce memory to each guest. > > That should be pretty easy though it will have an effect on guest > performance. > As long as its only done after an appropriately long idle period (ie: theres been X MB's free for a long time, give it back), I can't see it harming performance too much. At least not more than setting ram too low when manually (de)ballooning memory. -- Thomas Fjellstrom tfjellstrom@shaw.ca ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-15 23:21 ` Thomas Fjellstrom @ 2009-12-16 9:55 ` Avi Kivity 2009-12-16 9:58 ` Thomas Fjellstrom 0 siblings, 1 reply; 21+ messages in thread From: Avi Kivity @ 2009-12-16 9:55 UTC (permalink / raw) To: tfjellstrom; +Cc: kvm On 12/16/2009 01:21 AM, Thomas Fjellstrom wrote: > >>> The problem is it should be automatic. The balloon driver itself or >>> some other mechanism should be capable of noticing when it can free up >>> a bunch of guest memory. I can't be bothered to manually sit around and >>> monitor memory usage on my host so I can then go into virt-manager to >>> reduce memory to each guest. >>> >> That should be pretty easy though it will have an effect on guest >> performance. >> >> > As long as its only done after an appropriately long idle period (ie: theres > been X MB's free for a long time, give it back), I can't see it harming > performance too much. At least not more than setting ram too low when > manually (de)ballooning memory. > It depends on what your expectations are. If you have a lot of memory you might be surprised when you access an idle guest and have to wait for it to page itself back from disk. -- error compiling committee.c: too many arguments to function ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-16 9:55 ` Avi Kivity @ 2009-12-16 9:58 ` Thomas Fjellstrom 2009-12-16 10:00 ` Avi Kivity 0 siblings, 1 reply; 21+ messages in thread From: Thomas Fjellstrom @ 2009-12-16 9:58 UTC (permalink / raw) To: Avi Kivity; +Cc: kvm On Wed December 16 2009, Avi Kivity wrote: > On 12/16/2009 01:21 AM, Thomas Fjellstrom wrote: > >>> The problem is it should be automatic. The balloon driver itself or > >>> some other mechanism should be capable of noticing when it can free > >>> up a bunch of guest memory. I can't be bothered to manually sit > >>> around and monitor memory usage on my host so I can then go into > >>> virt-manager to reduce memory to each guest. > >> > >> That should be pretty easy though it will have an effect on guest > >> performance. > > > > As long as its only done after an appropriately long idle period (ie: > > theres been X MB's free for a long time, give it back), I can't see it > > harming performance too much. At least not more than setting ram too > > low when manually (de)ballooning memory. > > It depends on what your expectations are. If you have a lot of memory > you might be surprised when you access an idle guest and have to wait > for it to page itself back from disk. > Why would it be swaping in that case? Only unused/free/cache memory should be returned to the host. -- Thomas Fjellstrom tfjellstrom@shaw.ca ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-16 9:58 ` Thomas Fjellstrom @ 2009-12-16 10:00 ` Avi Kivity 2009-12-16 10:09 ` Thomas Fjellstrom 0 siblings, 1 reply; 21+ messages in thread From: Avi Kivity @ 2009-12-16 10:00 UTC (permalink / raw) To: tfjellstrom; +Cc: kvm On 12/16/2009 11:58 AM, Thomas Fjellstrom wrote: > >> It depends on what your expectations are. If you have a lot of memory >> you might be surprised when you access an idle guest and have to wait >> for it to page itself back from disk. >> >> > Why would it be swaping in that case? Only unused/free/cache memory should > be returned to the host Right, it would return cache memory, and when you use the guest next time, it will have to refill its cache. -- error compiling committee.c: too many arguments to function ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-16 10:00 ` Avi Kivity @ 2009-12-16 10:09 ` Thomas Fjellstrom 0 siblings, 0 replies; 21+ messages in thread From: Thomas Fjellstrom @ 2009-12-16 10:09 UTC (permalink / raw) To: kvm; +Cc: Avi Kivity On Wed December 16 2009, Avi Kivity wrote: > On 12/16/2009 11:58 AM, Thomas Fjellstrom wrote: > >> It depends on what your expectations are. If you have a lot of memory > >> you might be surprised when you access an idle guest and have to wait > >> for it to page itself back from disk. > > > > Why would it be swaping in that case? Only unused/free/cache memory > > should be returned to the host Unless of course you were referring to the case of manually de-ballooning memory in the guests. Yes, swapping in the guests is slow, and you should try not to set the memory limit (-m) too small for a given workload. Having a dynamic ballooning feature that did not actually change the guests view of ram wouldn't have that problem, especially since you're not returning any memory that's in use in the guest. And since KVM already supports running with large ranges of its assigned memory not actually assigned to it, dynamic ballooning probably isn't hard to support. The memory over-commit "rate" on my old setup was rather astonishing. A couple of my guests would eventually get as low as showing 10MB ram in use. Even the larger memory users would get down as low as 1/5th the allocated ram after sitting mostly idle for a while. But since the full assigned ram is sometimes needed, just reducing the total assignment isn't a good option. > Right, it would return cache memory, and when you use the guest next > time, it will have to refill its cache. Sure, but there are hours where the guests can run with minimal memory use. It would allow one to run many more guests at the same time, if you know some/many of them won't always be using all of their assigned ram. -- Thomas Fjellstrom tfjellstrom@shaw.ca ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-13 16:41 ` Thomas Fjellstrom 2009-12-13 16:45 ` Avi Kivity @ 2009-12-13 20:23 ` rek2 2009-12-13 21:42 ` Thomas Fjellstrom 1 sibling, 1 reply; 21+ messages in thread From: rek2 @ 2009-12-13 20:23 UTC (permalink / raw) To: tfjellstrom; +Cc: kvm, Avi Kivity Hi Thanks for the responses, but look: PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin /usr/bin/kvm -S -M pc-0.11 -m 1024 -smp 1 -name vm_hsci -uuid 52ed4c7c-65e4-325e-0f96-87a5be6d854c -monitor unix:/var/run/libvirt/qemu/vm_hsci.monitor,server,nowait -boot c -drive file=/var/kvm_images/vm_hsci.img,if=virtio,index=0,boot=on -net nic,macaddr=00:16:36:5b:c4:e2,vlan=0,name=nic.0 -net tap,fd=16,vlan=0,name=tap.0 -serial pty -parallel none -usb -vnc 127.0.0.1:0 -k en-us -vga cirrus -soundhw es1370 I have -m 1ith 1024 right? but if I do a top: 1214m 364m 3360 S 0 4.5 46:55.24 kvm so is clearly above -m what could be the issue? Thanks is using 1214 at this moment sometimes it goes up a lot more.. On 12/13/09 11:41 AM, Thomas Fjellstrom wrote: > On Sun December 13 2009, Avi Kivity wrote: > >> On 12/12/2009 10:37 PM, Thomas Fjellstrom wrote: >> >>> I have the opposite happen, when a VM is started, RES is usually lower >>> than -m, which I find slightly odd. But makes sense if qemu/kvm don't >>> actually allocate memory from the host till its requested the first >>> time >>> >> That is the case. >> >> >>> (if only it >>> would return some of it afterwards, it would be even better). >>> >> Use the balloon driver to return memory to the host. >> > Will it actually just free the memory and leave the total memory size in the > VM alone? Last I checked it would just decrease the total memory size, which > isn't that useful. Sometimes it needs more ram, so its given 512M ram, but > most of the time can live on 100M or so. > > >>> I just fully shut down and restarted on of my vms, which is set to use >>> 128-256 MB ram max. RES is like 72MB on start, and VIRT is 454M. RES >>> generally gets up around 120MB ram when its doing something. >>> >>> One thing I do find a little odd is one of my VMs which is allocated >>> 512MB ram, has a VIRT of 826MB ram. I didn't realize that qemu had so >>> many lib dependencies. >>> >> It's not just libraries, it's mostly glibc malloc() allocating huge >> pools per thread, as well as large thread stacks. >> >> >>> Due to kvm not supporting giving memory back, besides by >>> swapping large portions of unused guest ram, my host currently has over >>> 1G used swap. Not particularly happy with that, but it doesn't seem to >>> effect performance too much (except that it generally likes to swap >>> host processes first, guest performance is decent, but host, not so >>> much). >>> >> The Linux vm prefers anonymous memory, so guests do get an advantage. >> >> > I think the only thing I'd like to have now is automatic memory return, much > like vmware server has. It doesn't change what the guest VM sees, it just > flushes the unused ram back to the host. > > ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-13 20:23 ` rek2 @ 2009-12-13 21:42 ` Thomas Fjellstrom 2009-12-13 22:06 ` rek2 2009-12-14 15:50 ` rek2 0 siblings, 2 replies; 21+ messages in thread From: Thomas Fjellstrom @ 2009-12-13 21:42 UTC (permalink / raw) To: kvm; +Cc: rek2, Avi Kivity On Sun December 13 2009, rek2 wrote: > Hi Thanks for the responses, but look: > PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin > /usr/bin/kvm -S -M pc-0.11 -m 1024 -smp 1 -name vm_hsci -uuid > 52ed4c7c-65e4-325e-0f96-87a5be6d854c -monitor > unix:/var/run/libvirt/qemu/vm_hsci.monitor,server,nowait -boot c -drive > file=/var/kvm_images/vm_hsci.img,if=virtio,index=0,boot=on -net > nic,macaddr=00:16:36:5b:c4:e2,vlan=0,name=nic.0 -net > tap,fd=16,vlan=0,name=tap.0 -serial pty -parallel none -usb -vnc > 127.0.0.1:0 -k en-us -vga cirrus -soundhw es1370 > > I have -m 1ith 1024 right? > but if I do a top: > 1214m 364m 3360 S 0 4.5 46:55.24 kvm > > so is clearly above -m > what could be the issue? > Thanks VIRT includes a lot of shared memory, so it's not a very useful number to look at when trying to gauge how much memory a process is using. > > is using 1214 at this moment sometimes it goes up a lot more.. > > On 12/13/09 11:41 AM, Thomas Fjellstrom wrote: > > On Sun December 13 2009, Avi Kivity wrote: > >> On 12/12/2009 10:37 PM, Thomas Fjellstrom wrote: > >>> I have the opposite happen, when a VM is started, RES is usually > >>> lower than -m, which I find slightly odd. But makes sense if qemu/kvm > >>> don't actually allocate memory from the host till its requested the > >>> first time > >> > >> That is the case. > >> > >>> (if only it > >>> would return some of it afterwards, it would be even better). > >> > >> Use the balloon driver to return memory to the host. > > > > Will it actually just free the memory and leave the total memory size > > in the VM alone? Last I checked it would just decrease the total memory > > size, which isn't that useful. Sometimes it needs more ram, so its > > given 512M ram, but most of the time can live on 100M or so. > > > >>> I just fully shut down and restarted on of my vms, which is set to > >>> use 128-256 MB ram max. RES is like 72MB on start, and VIRT is 454M. > >>> RES generally gets up around 120MB ram when its doing something. > >>> > >>> One thing I do find a little odd is one of my VMs which is allocated > >>> 512MB ram, has a VIRT of 826MB ram. I didn't realize that qemu had so > >>> many lib dependencies. > >> > >> It's not just libraries, it's mostly glibc malloc() allocating huge > >> pools per thread, as well as large thread stacks. > >> > >>> Due to kvm not supporting giving memory back, besides by > >>> swapping large portions of unused guest ram, my host currently has > >>> over 1G used swap. Not particularly happy with that, but it doesn't > >>> seem to effect performance too much (except that it generally likes > >>> to swap host processes first, guest performance is decent, but host, > >>> not so much). > >> > >> The Linux vm prefers anonymous memory, so guests do get an advantage. > > > > I think the only thing I'd like to have now is automatic memory return, > > much like vmware server has. It doesn't change what the guest VM sees, > > it just flushes the unused ram back to the host. > > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- Thomas Fjellstrom tfjellstrom@shaw.ca ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-13 21:42 ` Thomas Fjellstrom @ 2009-12-13 22:06 ` rek2 2009-12-14 15:50 ` rek2 1 sibling, 0 replies; 21+ messages in thread From: rek2 @ 2009-12-13 22:06 UTC (permalink / raw) To: tfjellstrom; +Cc: kvm, Avi Kivity On 12/13/09 4:42 PM, Thomas Fjellstrom wrote: > On Sun December 13 2009, rek2 wrote: > >> Hi Thanks for the responses, but look: >> PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin >> /usr/bin/kvm -S -M pc-0.11 -m 1024 -smp 1 -name vm_hsci -uuid >> 52ed4c7c-65e4-325e-0f96-87a5be6d854c -monitor >> unix:/var/run/libvirt/qemu/vm_hsci.monitor,server,nowait -boot c -drive >> file=/var/kvm_images/vm_hsci.img,if=virtio,index=0,boot=on -net >> nic,macaddr=00:16:36:5b:c4:e2,vlan=0,name=nic.0 -net >> tap,fd=16,vlan=0,name=tap.0 -serial pty -parallel none -usb -vnc >> 127.0.0.1:0 -k en-us -vga cirrus -soundhw es1370 >> >> I have -m 1ith 1024 right? >> but if I do a top: >> 1214m 364m 3360 S 0 4.5 46:55.24 kvm >> >> so is clearly above -m >> what could be the issue? >> Thanks >> > VIRT includes a lot of shared memory, so it's not a very useful number to > look at when trying to gauge how much memory a process is using. > Ok, so then what stats should we look to calculate the amount of memory a server should have depending on how many guest VM's we will like to use? Thanks again ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-13 21:42 ` Thomas Fjellstrom 2009-12-13 22:06 ` rek2 @ 2009-12-14 15:50 ` rek2 2009-12-14 19:57 ` Thomas Fjellstrom 2009-12-15 10:07 ` Avi Kivity 1 sibling, 2 replies; 21+ messages in thread From: rek2 @ 2009-12-14 15:50 UTC (permalink / raw) To: tfjellstrom; +Cc: kvm, Avi Kivity >> > VIRT includes a lot of shared memory, so it's not a very useful number to > look at when trying to gauge how much memory a process is using. > Ok, so then what stats should we look to calculate the amount of memory a server should have depending on how many guests we will like to use? Thanks again -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-14 15:50 ` rek2 @ 2009-12-14 19:57 ` Thomas Fjellstrom 2009-12-15 10:07 ` Avi Kivity 1 sibling, 0 replies; 21+ messages in thread From: Thomas Fjellstrom @ 2009-12-14 19:57 UTC (permalink / raw) To: kvm On Mon December 14 2009, rek2 wrote: > > VIRT includes a lot of shared memory, so it's not a very useful number > > to look at when trying to gauge how much memory a process is using. > > Ok, so then what stats should we look to calculate the amount of memory > a server should have depending on how many guests we will like to use? > > Thanks again > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html If you want to be extra careful, you'll want to get as much ram as you need for all the guests, and the host, and probably leave a little free for the host to use as a disk cache. At least with the kvm setup I have, there is no way to overcommit memory, other than to use the hosts swap. Things are pretty tight memory wise for me, I'm hoping KSM in 2.6.32 will help alleviate matters some what. -- Thomas Fjellstrom tfjellstrom@shaw.ca ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: Memory under KVM? 2009-12-14 15:50 ` rek2 2009-12-14 19:57 ` Thomas Fjellstrom @ 2009-12-15 10:07 ` Avi Kivity 1 sibling, 0 replies; 21+ messages in thread From: Avi Kivity @ 2009-12-15 10:07 UTC (permalink / raw) To: rek2; +Cc: tfjellstrom, kvm On 12/14/2009 05:50 PM, rek2 wrote: > >> VIRT includes a lot of shared memory, so it's not a very useful >> number to >> look at when trying to gauge how much memory a process is using. >> > Ok, so then what stats should we look to calculate the amount of > memory a server should have depending on how many guests we will like > to use? The -m parameter to qemu, plus some overhead. If you use ksm or ballooning or ssd swap you can overcommit, how much depends on your workload. -- error compiling committee.c: too many arguments to function ^ permalink raw reply [flat|nested] 21+ messages in thread
* Memory under KVM? @ 2009-12-10 22:10 Christian Fernandez 0 siblings, 0 replies; 21+ messages in thread From: Christian Fernandez @ 2009-12-10 22:10 UTC (permalink / raw) To: kvm Hi everyone, I'm new to the list and I have a couple questions that we are wondering about here at work... we have notice that the KVM processes on the host take much more memory than the memory we have told the VM to use.. a ruff example.. if we tell KVM to use 2 gigs for one VM it will end up showing on the host process list for that VM like 3 gigs or more... Why do I ask this? well we need to figure out how much memory to add to our host server so we can calculate the number of VM's we can run there etc etc.. Thanks for the help The information in this e-mail is intended only for the person to whom it is addressed. If you believe this e-mail was sent to you in error and the e-mail contains patient information, please contact the Partners Compliance HelpLine at http://www.partners.org/complianceline . If the e-mail was sent to you in error but does not contain patient information, please contact the sender and properly dispose of the e-mail. ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2009-12-16 10:09 UTC | newest] Thread overview: 21+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-12-11 21:43 Memory under KVM? rek2 2009-12-11 22:54 ` Brian Jackson 2009-12-12 8:09 ` Avi Kivity 2009-12-12 20:37 ` Thomas Fjellstrom 2009-12-13 10:08 ` Avi Kivity 2009-12-13 16:41 ` Thomas Fjellstrom 2009-12-13 16:45 ` Avi Kivity 2009-12-13 17:16 ` Thomas Fjellstrom 2009-12-15 10:06 ` Avi Kivity 2009-12-15 23:21 ` Thomas Fjellstrom 2009-12-16 9:55 ` Avi Kivity 2009-12-16 9:58 ` Thomas Fjellstrom 2009-12-16 10:00 ` Avi Kivity 2009-12-16 10:09 ` Thomas Fjellstrom 2009-12-13 20:23 ` rek2 2009-12-13 21:42 ` Thomas Fjellstrom 2009-12-13 22:06 ` rek2 2009-12-14 15:50 ` rek2 2009-12-14 19:57 ` Thomas Fjellstrom 2009-12-15 10:07 ` Avi Kivity -- strict thread matches above, loose matches on Subject: below -- 2009-12-10 22:10 Christian Fernandez
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).