[Lxc-users] memory limit

Papp Tamas tompos at martos.bme.hu
Tue Aug 16 07:36:08 UTC 2011


On 2011-08-16 00:29, Daniel Lezcano wrote:
> On 08/12/2011 11:51 PM, Papp Tamas wrote:
>> hi!
>>
>> I'm asking you about limiting memory.
>>
>> This is the test config:
>> lxc.cgroup.memory.limit_in_bytes = 16M
>> lxc.cgroup.memory.memsw.limit_in_bytes = 1G
>> lxc.cgroup.cpuset.cpus = 0-1
>> lxc.cgroup.cpu.shares = 1024
>>
>> I run apt-get upgrade and an openfire server (java) as memory harvester
>> jobs.
>>
>>    23:42:37 up  1:54,  3 users,  load average: 3.08, 2.47, 1.42
>>
>> $ vmstat 5
>> procs -----------memory---------- ---swap-- -----io---- -system--
>> ----cpu----
>>    r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy
>> id wa
>>    5  3  94952 2356752  79004 1051784   52   60   132   110  104  170  2
>> 1 94  4
>>    0  4  97280 2358896  79012 1051772 2105 2254  2105  2396  940 1163  2
>> 3 40 56
>>    0  1  98544 2358276  79036 1051764 1374 1060  1374  1177  493  963  1
>> 2 48 50
>>    0  4  99384 2358880  79056 1052460 1538 1432  4286  1526  727 1207  0
>> 2 38 59
>>    0  3 100596 2355212  79064 1052476  666  645  3718   718  483 1067  1
>> 3 37 59
>>    0  3 104132 2350996  79064 1052588 1039 1106  4606  1224  540  961  1
>> 2 41 56
>>    0  3 104488 2350376  79088 1052172  938  641  3624   756  505  865  0
>> 1 42 57
>>    1  3 103964 2349552  79096 1052568  642  426  3598   477  591  886 16
>> 1 26 56
>>    0  3 103860 2350008  79112 1052360  491  357  4277   434  850  957 39
>> 1 10 50
>>    0  4 104652 2350908  79112 1052056  738  746  5207   813  804 1049 23
>> 2 18 57
>>    0  2 106320 2350016  79120 1052464  825  706  5439   789  941  983 33
>> 1 13 53
>>    0  8 105540 2347444  79136 1052264 1185  290  4692   379  484  890  1
>> 1 34 64
>>    0  7 107756 2347000  79144 1052448  948  950  2970  1002  555  900  1
>> 2 36 62
>>    0  2 106868 2346528  79152 1052428  674  316  4130   402  446  825  1
>> 2 43 55
>>    0  2 104556 2346372  79160 1052160  570  261  3872   343  492  865  1
>> 3 40 55
>>    0  2 104976 2345504  79176 1052560  606  506  4298   612  444  839  1
>> 2 43 54
>>    0  2 104004 2345256  79184 1052476  442  277  3633   362  401  765  2
>> 2 40 55
>>    0  3 104000 2345248  79192 1052156  555  406  3237   493  475  792  2
>> 3 37 58
>>    0  7 105044 2344728  79200 1052156  854  775  3691   867  498  902  0
>> 2 40 58
>>    0  4 105036 2344472  79208 1052396  790  586  3428   668  477  865  1
>> 2 33 65
>>    0  4 105956 2344248  79216 1052372  590  487  4104   578  562  833  1
>> 2 35 62
>>    0  4 105268 2343496  79224 1052296  681  317  3506   399  425  793  1
>> 0 41 58
>>    0  2 105736 2343216  79232 1052284  394  284  3578   373  441  773  0
>> 1 45 54
>>    0  2 105072 2343464  79248 1052252  773  538  5720   632  534  908  0
>> 1 44 55
>>    0  2 105572 2342968  79256 1052560  436  342  4547   428  419  806  0
>> 1 46 52
>>    0  2 106000 2345108  79264 1052444  591  867  4534   946  525  862  1
>> 1 44 54
>>    1  3 103092 2345076  79280 1052220  906  234  4302   329  470  885  0
>> 1 42 57
>>    0  2 104636 2345200  79288 1052448  747  870  3556   942  548  886  0
>> 1 37 61
>>    0  4 105296 2344992  79296 1052152  489  451  3738   550  439  780  0
>> 1 44 55
>>    0  2 103968 2346372  79304 1052268  858  674  4669   778  578  913  1
>> 1 37 61
>>    0  2 104052 2346612  79312 1052672  425  346  3766   444  424  786  0
>> 1 46 53
>>    0  2 104476 2347364  79320 1052164  310  224  3352   294  410  747  0
>> 1 42 56
>>    0  2 105428 2347356  79328 1052520  408  456  4321   547  471  918  1
>> 1 45 53
>>    1  4 104384 2349720  79336 1052164  586  320  4389   417  482  828  0
>> 1 44 55
>>    0  3 104672 2350200  79352 1052136  462  378  3098   502  508  898  0
>> 2 38 60
>>    0  2 105584 2349820  79368 1052168  544  490  4173   583  501  814  0
>> 2 45 54
>>    0  2 105344 2349572  79376 1052524  514  266  4138   366  481  822  0
>> 1 44 55
>>    0  2 105488 2348580  79384 1052424  727  410  4162   492  514  839  0
>> 2 41 57
>>    0  2 103904 2350068  79400 1052544 1058  781  5232   886  583  926  0
>> 2 42 56
>>
>>
>> Before starting the container the swap usage was zero.
>>
>> The problem is all of the container start working slower, for example
>> the lag of ssh sessions is increased.
>>
>>
>> Is this a normal behaviour? I think, this paging should not do this.
> If you reduce the memory for a container at a point where it swaps,
> automatically that will reduce the performances of the whole system by
> adding a lot of disk IO.
>
> Using the cgroup memory is like reducing the RAM. I am not sure 16M is
> sufficient to run an apt-upgrade command. What are you trying to achieve
> with 16M on your container ? What application today runs with 16MB of RAM ?

I set up 16M RAM only for testing purposes.

Check si/so columns, doyou think it's swapping so much that explains it?

I'm not sure, but I'm not an expert on this subject, that's why I'm 
asking you:)

Thanks,
tamas




More information about the lxc-users mailing list