[lxc-users] which container is swapping?

Jäkel, Guido G.Jaekel at dnb.de
Tue Jun 21 13:54:39 UTC 2016


Dear Harald,

years ago I scripted my own lxc-free to be used as something lxc-aware inside the container. It's based on the memory controllers values, too. Please take a look at memory.stats, too. Here, I get other values to calculate the values for RSS+Cache, active, free and used RAM, too. 

It may act from outside (for all) or inside (for one) because I let bind-mount the containers cgroup to the container. I'm still using the old (legacy?) setup with one cgroup directory per container with all controllers attached to it (/cgroup/lxc/<container>/foo), therefore I just have to reach-in one directory via a calculated bind mount.

I'll may send you the script if you like. To be accurate, my current version just reports the "other" values for free/used memory. But this is just because I don't use swap space at all and you may easily add it  -- it's a diskless bladecenter and all filesystems are NFS. And to my knowledge, the only technical way to get swap on NFS is to loop-mount an image file - but this is an abstruse one.

Greetings

Guido


>-----Original Message-----
>From: lxc-users [mailto:lxc-users-bounces at lists.linuxcontainers.org] On Behalf Of Harald Dunkel
>Sent: Tuesday, June 21, 2016 3:28 PM
>To: LXC users mailing-list
>Subject: [lxc-users] which container is swapping?
>
>Hi folks,
>
>Is there some way to monitor local memory swapping *inside*
>the container?
>
>Long story:
>I had to restrict memory usage for a set of containers, using
>lines like
>
>	lxc.cgroup.memory.limit_in_bytes = 12G
>
>in the config file. The memory limits are not the same for
>all hosts.
>
>Of course some containers don't play nice and use more memory
>than allowed. The server starts swapping.
>
>AFAICS I can examine /cgroup/lxc/.../memory.memsw.usage_in_bytes
>and memory.usage_in_bytes on the server, but I would prefer to
>monitor swapping inside the container. What would you suggest?
>
>BTW, I wonder why lxc-info and lxc-top don't tell how much swap
>space each container uses?
>
>LXC is 1.1.5 (still).
>
>
>Every helpful hint is highly appreciated
>Harri
>_______________________________________________
>lxc-users mailing list
>lxc-users at lists.linuxcontainers.org
>http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list