From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andre Przywara Subject: Re: .img on nfs, relative on ram, consuming mass ram Date: Mon, 20 Sep 2010 16:00:53 +0200 Message-ID: <4C976915.5010305@amd.com> References: <20100915113941.9536341d.f.tournier@iut.univ-paris8.fr> <4C91DEDD.9030508@amd.com> <20100916140139.e5c4a8fe.f.tournier@iut.univ-paris8.fr> <4C9207AA.9070009@amd.com> <4C922022.50404@amd.com> <20100920153058.224f5038.f.tournier@iut.univ-paris8.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Stefan Hajnoczi , "kvm@vger.kernel.org" To: =?ISO-8859-1?Q?TOURNIER_Fr=E9d=E9ric?= Return-path: Received: from tx2ehsobe005.messaging.microsoft.com ([65.55.88.15]:9664 "EHLO TX2EHSOBE010.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752672Ab0ITOBs convert rfc822-to-8bit (ORCPT ); Mon, 20 Sep 2010 10:01:48 -0400 In-Reply-To: <20100920153058.224f5038.f.tournier@iut.univ-paris8.fr> Sender: kvm-owner@vger.kernel.org List-ID: TOURNIER Fr=E9d=E9ric wrote: > Heres my benches, done in two days so dates are weird and results are= very approximative. > What surprises me are in the Part 2, swap occured. I don't know exactly why, but I have seen a small usage of swap=20 occasionally without real memory pressure. So I'd consider this normal. > In 3 and 4, the ram is eaten up, even if the vm just booted. Where is the RAM eaten up? I see always always 800 MB free, some more=20 even after the d/l: You have to look at the second line of the free column, no the first=20 one. As you can see the OS has still enough RAM to afford a large cache= ,=20 so it uses this. Unused RAM is just a waste of resources (because it is= =20 always there and there is no reason to not use it). If the 'cached'=20 contains a lot of clean pages, the OS can simply claim them should an=20 application request more memory. If you want a proof of this, try: # echo 3 > /proc/sys/vm/drop_caches This should free the cache and give you a high "real" free value back. Have you tried cache=3Dnone with the tmpfs scenario? That should save y= ou=20 some of the host's cached memory (note the difference between part 1 an= d=20 part2 in that respect), maybe at the expense of the guest's memory used= =20 more heavily. Your choice here, that depends on the actual memory=20 utilization in the guest. As I said before, it is not a very good idea to use such a setup (with=20 the relative image on tmpfs) if you are doing actual disk I/O,=20 especially large writes. AFAIK QCOW[2] does not really shrink, it only=20 grows, so you will end up with out-of-memory at some point. But if you can restrict the amount of written data, this may work. Regards, Andre. P.S. Sorry for the confusion about tmpfs vs. ramfs in my last week's ma= il. >=20 > ------------------------------------ > Part 0 >=20 > End of boot : >=20 > bash-3.1$ free > total used free shared buffers ca= ched > Mem: 2056840 500836 1556004 0 2244 35= 9504 > -/+ buffers/cache: 139088 1917752 > Swap: 3903784 0 3903784 >=20 > ------------------------------------ >=20 > Part 1 >=20 > qemu-system-x86_64 -m 1024 -vga std -usb -usbdevice tablet -localtime= -soundhw es1370 -name qlio -drive file=3D/mnt/hd/sda/sda1/tmp/relqlio.= img,cache=3Dnone >=20 > bash-3.1$ free > total used free shared buffers ca= ched > Mem: 2056840 1656280 400560 0 34884 37= 8332 > -/+ buffers/cache: 1243064 813776 > Swap: 3903784 0 3903784 >=20 > bash-3.1$ ls -lsa /mnt/hd/sda/sda1/tmp/relqlio.img > 58946 -rw-r--r-- 1 ftournier info 60424192 2010-09-16 17:49 /mnt/hd/s= da/sda1/tmp/relqlio.img >=20 > 650M download inside the vm >=20 > bash-3.1$ free > total used free shared buffers ca= ched > Mem: 2056840 1677648 379192 0 33860 39= 7716 > -/+ buffers/cache: 1246072 810768 > Swap: 3903784 0 3903784 >=20 > bash-3.1$ ls -lsa /mnt/hd/sda/sda1/tmp/relqlio.img > 914564 -rw-r--r-- 1 ftournier info 935723008 2010-09-20 14:07 /mnt/hd= /sda/sda1/tmp/relqlio.img >=20 > ------------------------------------ >=20 > Part 2 >=20 > reboot >=20 > qemu-system-x86_64 -m 1024 -vga std -usb -usbdevice tablet -localtime= -soundhw es1370 -name qlio -drive file=3D/mnt/hd/sda/sda1/tmp/relqlio.= img >=20 > bash-3.1$ free > total used free shared buffers ca= ched > Mem: 2056840 2040172 16668 0 32952 75= 8948 > -/+ buffers/cache: 1248272 808568 > Swap: 3903784 0 3903784 >=20 > bash-3.1$ ls -lsa /mnt/hd/sda/sda1/tmp/relqlio.img > 60739 -rw-r--r-- 1 ftournier info 62259200 2010-09-16 17:57 /mnt/hd/s= da/sda1/tmp/relqlio.img >=20 > 650M download inside the vm >=20 > bash-3.1$ free > total used free shared buffers ca= ched > Mem: 2056840 2040540 16300 0 34412 76= 5208 > -/+ buffers/cache: 1240920 815920 > Swap: 3903784 8160 3895624 >=20 > bash-3.1$ ls -lsa /mnt/hd/sda/sda1/tmp/relqlio.img > 842430 -rw-r--r-- 1 ftournier info 861929472 2010-09-20 14:20 /mnt/hd= /sda/sda1/tmp/relqlio.img >=20 > ------------------------------------ >=20 > Part 3 >=20 > reboot >=20 > qemu-system-x86_64 -m 1024 -vga std -usb -usbdevice tablet -localtime= -soundhw es1370 -name qlio -drive file=3D/tmp/relqlio.img >=20 > note : /tmp is a tmpfs filesystem >=20 > bash-3.1$ free > total used free shared buffers ca= ched > Mem: 2056840 2009688 47152 0 248 76= 6328 > -/+ buffers/cache: 1243112 813728 > Swap: 3903784 0 3903784 >=20 > bash-3.1$ ls -lsa /tmp/relqlio.img > 59848 -rw-r--r-- 1 ftournier info 61407232 2010-09-16 18:04 /tmp/relq= lio.img >=20 > 650M download inside the vm >=20 > bash-3.1$ free > total used free shared buffers ca= ched > Mem: 2056840 2041404 15436 0 128 92= 1276 > -/+ buffers/cache: 1120000 936840 > Swap: 3903784 248804 3654980 >=20 > bash-3.1$ ls -lsa /tmp/relqlio.img > 885448 -rw-r--r-- 1 ftournier info 906821632 2010-09-20 14:40 /tmp/re= lqlio.img >=20 > ------------------------------------ >=20 > Part 4 >=20 > reboot >=20 > qemu-system-x86_64 -m 1024 -vga std -usb -usbdevice tablet -localtime= -soundhw es1370 -name qlio -drive file=3D/dev/shm/relqlio.img >=20 > bash-3.1$ free > total used free shared buffers ca= ched > Mem: 2056840 2009980 46860 0 172 76= 7328 > -/+ buffers/cache: 1242480 814360 > Swap: 3903784 0 3903784 >=20 > bash-3.1$ ls -lsa /dev/shm/relqlio.img > 58496 -rw-r--r-- 1 ftournier info 59899904 2010-09-16 18:11 /dev/shm/= relqlio.img >=20 > 650M download inside the vm >=20 > bash-3.1$ free > total used free shared buffers ca= ched > Mem: 2056840 2041576 15264 0 92 93= 8976 > -/+ buffers/cache: 1102508 954332 > Swap: 3903784 266232 3637552 >=20 > bash-3.1$ ls -lsa /dev/shm/relqlio.img > 1016912 -rw-r--r-- 1 ftournier info 1039400960 2010-09-20 15:15 /dev/= shm/relqlio.img >=20 --=20 Andre Przywara AMD-OSRC (Dresden) Tel: x29712