[lxc-users] LXD and Kernel Samepage Merging (KSM)

Stéphane Graber stgraber at ubuntu.com
Sun Jun 4 17:16:15 UTC 2017


On Sun, Jun 04, 2017 at 12:16:50PM -0400, Ron Kelley wrote:
> (Reviving the thread about Container Scaling:  https://lists.linuxcontainers.org/pipermail/lxc-users/2016-May/011607.html)
> 
> We have hit critical mass with LXD 2.12 and I need to get Kernel Samepage Merging (KSM) working as soon as possible.  All my research has come to a dead-end, and I am reaching out to the group at large for suggestions.
> 
> Background: We have 5 host servers - each running U16.04 (4.4.0-57-generic), 8G RAM, 20G SWAP, and 50 containers (exact configs per server - nginx and php 7).
> 
> I am trying to get KSM working since each container is an identical replica of the other (other than hostname/IP).  I have read a ton of information on the ‘net about Ubuntu and KSM, yet I can’t seem to get any pages to share on the host.  I am not sure if this is a KSM config issue or if LXD won’t allow KSM between containers.
> 
> 
> Here is what I have done thus far:
> ----------------------------------
> * Installed the ksmtuned utility and verified ksmd is running on each host.
> * Created the ksm_preload and ksm-wrapper tools per this site (the https://github.com/unbrice/ksm_preload).
> * Created 50 identical Ubuntu 16.04 containers running nginx
> * Modified the nginx startup script on each container to include the ksm_preload.so library; no issues running nginx.
> 
> (Note: since I could not find the ksm_preload library for Ubuntu, I had to use the ksm-wrapper tool listed above)
> 
> All the relevant files under /sys/kernel/mm/ksm still show 0 (pages_shared, pages_sharing, etc) regardless of what I do.
> 
> 
> Can any (@stgraber @brauner) confirm if KSM is supported with LXD?  If so, what is the “magic” to make it work?  We really want to get 2-3x more sites per container if possible.
> 
> 
> Thanks.

I'm not familiar with the use of KSM outside of the typicaly virtual
machine case (where a single process, "qemu", own the whole VM memory
and can properly mark things for KSM to merge).

LXD doesn't own or control the memory of its containers, so I don't
think there's anything that LXD itself can do to allow or prevent the
use of KSM.

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170604/64381d7d/attachment-0001.sig>


More information about the lxc-users mailing list