OpenVZ Forum


Home » General » Support » Problem with RAM and swap (VPS don't swap)
Problem with RAM and swap [message #40895] Thu, 21 October 2010 18:41 Go to next message
nubio is currently offline  nubio
Messages: 8
Registered: July 2010
Junior Member
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 ..
Sad

[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 !
Re: Problem with RAM and swap [message #40920 is a reply to message #40895] Mon, 25 October 2010 11:18 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

Go read wiki, http://wiki.openvz.org/UBC and so on.

Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: Problem with RAM and swap [message #40921 is a reply to message #40920] Mon, 25 October 2010 11:21 Go to previous messageGo to next message
nubio is currently offline  nubio
Messages: 8
Registered: July 2010
Junior Member
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


Re: Problem with RAM and swap [message #40922 is a reply to message #40920] Mon, 25 October 2010 11:27 Go to previous messageGo to next message
nubio is currently offline  nubio
Messages: 8
Registered: July 2010
Junior Member
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
Re: Problem with RAM and swap [message #40926 is a reply to message #40922] Tue, 26 October 2010 08:43 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

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.


Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: Problem with RAM and swap [message #40930 is a reply to message #40922] Tue, 26 October 2010 13:35 Go to previous messageGo to next message
khorenko is currently offline  khorenko
Messages: 533
Registered: January 2006
Location: Moscow, Russia
Senior Member
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


If your problem is solved - please, report it!
It's even more important than reporting the problem itself...
Re: Problem with RAM and swap [message #40958 is a reply to message #40895] Wed, 27 October 2010 19:35 Go to previous message
nubio is currently offline  nubio
Messages: 8
Registered: July 2010
Junior Member
Thanks you very much.
Ok i will never see the swap used inside a container.

Thanks for support !
Previous Topic: Network Card Bonding, additional IP range
Next Topic: very odd error caused by a particular VE
Goto Forum:
  


Current Time: Thu Aug 15 15:15:05 GMT 2024

Total time taken to generate the page: 0.02857 seconds