grycap / cloudvamp

An Automatic Oversubscription Framework for On-Premises Clouds
http://www.grycap.upv.es/cloudvamp
Apache License 2.0
17 stars 6 forks source link

Dynamic memory and linux pagecache #6

Closed feldsam closed 8 years ago

feldsam commented 8 years ago

Hi, I installed CloudVamp and enabled it on some linux VMs, but I experience problem with expanding pagecache. MR reports free memory expect pagecache/buffers, so when VM start, CVEM set memory for ex. to half of max memory. In VM runs some processes which read/write from/to disk, so pagecache fill free memory space. CVEM think, that free memory is under desired value, so allocate more memory to VM. Pagecache again fill free memory and so on.... So after some time I have all VMs on maxmemory.

I try to edit MR to report cache/buffers as free memory, but it lead to intensive swapping and high loads, because CVEM doesn't leave enough space for cache/buffers. I also try to edit kernel vm. vars to eliminate big pagecache, but without success.

Ex. webserver VM

             total       used       free     shared    buffers     cached
Mem:      10268352    8584424    1683928          0     883588    3740468
-/+ buffers/cache:    3960368    6307984
Swap:      1150972       8736    1142236

Kernel vm settings

vm.swappiness = 0
vm.vfs_cache_pressure = 50
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10

Ex. openvz VM with same kernel settings

             total       used       free     shared    buffers     cached
Mem:      11266792   10469660     797132          0     283564    4618808
-/+ buffers/cache:    5567288    5699504
Swap:      5242876     116508    5126368

I personally think, that MR or CVEM should care about cache/buffers or probably I can add new key 'MIN_FREE_MEM' to VM user template, so I can set this value per VM and leave some space for pagecache which improves I/O.

What you think about that?

micafer commented 8 years ago

Hi Kristian,

You are right, currently the MR is reporting only the free memory without considering cache/buffers. We have modified the onegate scripts to consider them.

Regarding adding the ‘MIN_FREE_MEM’ to the VM user template, it is a good idea but not only the MIN_FREE_MEM (that triggers the exponential backoff) but also the MEM_OVER (Memory Overprovisioning Ratio) that manages the normal function of CVEM.

We made these changes in the branch issue6 but we have not tested it yet.

Thanks for your contribution.

feldsam commented 8 years ago

Hi, I edit MR to report free mem incl. buffers/cache again, and them I try to change MEM_OVER to 40%.

It looks much better, because there is space for cache/buffers, so no swapping and high loads... So when we will use new MR then I recommend to raise mem_over to 40% in default config also

One thing I noticed is that cvem change memory more often now, looks like every iteration, so cooldown period takes in effect. I don't know, if this is ok...

I also test your last commits in the branch issue6, and there are no issues with code itself.

micafer commented 8 years ago

This issue has been solved and merged into master branch.

feldsam commented 8 years ago

What about default MEM_OVER in config? I think that should be raised, because you update MR script to report cache/buffers as free mem