OpenVZ Forum - RDF feed
type: channel
items: Problem with RAM and swap
items: Re: Problem with RAM and swap

Problem with RAM and swap
type: item
description: Hello everybody, I need help to understand why my containers don't swap ! [Hardware@node]# free -m total used free shared buffers cached Mem: 7957 7863 93 0 494 1627 -/+ buffers/cache: 5741 2215 Swap: 76316 14 76301 Memory used by a container [Hardware@node]# vzctl exec 122 free -m total used free shared buffers cached Mem: 2048 1446 601 0 0 0 -/+ buffers/cache: 1446 601 Swap: 4194303 0 4194303 It doesn't swap .. and i usely have cannot allowed memory .. [Hardware@node]# vzctl exec 122 cat /proc/user_beancounters Version: 2.5 uid resource held maxheld barrier limit failcnt 122: kmemsize 12454306 17769132 29491200 32440320 0 lockedpages 0 8 256 256 0 privvmpages 370196 451812 524288 524288 2 shmpages 3547 34020 131072 131072 0 dummy 0 0 0 0 0 numproc 127 167 450 450 0 physpages 118534 189254 1024 2147483647 0 vmguarpages 0 0 524288 524288 0 oomguarpages 118916 191761 2147483647 524288 0 numtcpsock 36 133 4500 4500 0 numflock 12 60 270 297 0 numpty 0 3 20 20 0 numsiginfo 0 18 1024 1024 0 tcpsndbuf 632472 3914920 36864000 48384000 0 tcprcvbuf 589824 6492384 36864000 48384000 0 othersockbuf 247464 1004464 1126080 12646080 0 dgramrcvbuf 0 134312 262144 262144 0 numothersock 152 422 4500 4500 0 dcachesize 2473536 3032101 8847360 9732096 0 numfile 3271 4945 11250 11250 0 dummy 0 0 0 0 0 dummy 0 0 0 0 0 dummy 0 0 0 0 0 numiptent 18 18 400 400 0 Could you help me or explain me why ? Thanks in advance !
creator: nubio
date: 2010-10-21T18:41:12-00:00

Re: Problem with RAM and swap
type: item
description: Go read wiki, http://wiki.openvz.org/UBC and so on.
creator: kir
date: 2010-10-25T11:18:51-00:00

Re: Problem with RAM and swap
type: item
description: I already read this and i tried to put the good UBC for it I spent 3 days to create an excel file to automatically calcul the good UBC paraemter All run fine except the SWAP Please could you help ? I don't want to waste your time but i really don't understand why the VPS can't swap The swap partition is for all containers .. and in each container i see some swap but it's not accessible .. [Hardware@node]# vzctl exec 122 free -m total used free shared buffers cached Mem: 2048 1446 601 0 0 0 -/+ buffers/cache: 1446 601 Swap: 4194303 0 4194303
creator: nubio
date: 2010-10-25T11:21:50-00:00

Re: Problem with RAM and swap
type: item
description: I found this : As xemul said.. the VE has no concept of the difference between ram and swap. Its just "memory" at the VE level. So, your HN can have 64MB of ram and 64GB of swap. Or, your HN can have 64GB of ram and 64MB of swap. In the VE, the privvm, oomguar, vmguar are uneffected by this. Only the performance changes between the two scenarios. In either case, you can guarantee and limit each VE to an arbitrary amount of memory. This drastically differs from the conventional mem management of vmware/xen (isoloation). VZ is a shared kernel model and no resources are "hard dedicated" or "hard assigned". -not possible to give/assign/guarantee a VE XX swap and YY physical memory -not possible to restrict a VE from using physical memory and use swap instead Think of the VZ virtual servers like resource containers, not individual linux boxes- VZ is a shared kernel approach to virtualization. Hope this clears it up for you. So i a VPS have 512Mo of memory it could be RAM or SWAP ? But it's not possible to give some extra swap ? For example apache2 need swap to working fine .. I will see the server swaping when all my memory physic will be full used ? Regards, Quentin
creator: nubio
date: 2010-10-25T11:27:10-00:00

Re: Problem with RAM and swap
type: item
description: nubio wrote on Mon, 25 October 2010 15:27 I will see the server swaping when all my memory physic will be full used ? Yes indeed, if there will be RAM shortage, swap will be used.
creator: kir
date: 2010-10-26T08:43:25-00:00

Re: Problem with RAM and swap
type: item
description: nubio wrote on Mon, 25 October 2010 15:27 So i a VPS have 512Mo of memory it could be RAM or SWAP ? But it's not possible to give some extra swap ? As it was already said by xemul when you set up a "privvmpages" limit for a Container, it means that the Container will be able to allocate that number of Virtual Memory. And you cannot say for sure how many of those pages will be in real physical memory and many of them will be in swap (on the Hardware Node!) just because it depends on the memory amount available on Hardware Node itself. If there is enough memory on the Hardware Node then all the memory allocated by Container will be in physical node RAM. If not - some pages will be swapped out. nubio wrote on Mon, 25 October 2010 15:27 For example apache2 need swap to working fine .. I will see the server swaping when all my memory physic will be full used ? That fake swap entry was done to be shown inside a Container especially for those silly applications which check the swap presence on start or installation stage. So the Swap at the moment is only REPORTED inside a CT, you'll never see it is reported as "used" inside a CT. And yes - in case the whole Hardware Node lacks the physical RAM, it will use swap and memory pages (both allocated by Hardware Node itself and by Containers) may be swapped out. Hope that helps. -- Konstantin
creator: khorenko
date: 2010-10-26T13:35:26-00:00

Re: Problem with RAM and swap
type: item
description: Thanks you very much. Ok i will never see the swap used inside a container. Thanks for support !
creator: nubio
date: 2010-10-27T19:35:28-00:00