I'm planning to rent a physical server and run MySQL inside an LXC container on that server. I'd like to control maximum memory usage for the MySQL instance using cgroup limits :
lxc.cgroup.memory.limit_in_bytes = 8192M
This will effectively control how much memory the container may use, but top
or free
inside the container will still report overall memory for the LXC host (physical server). I'm not an expert in how Linux manages memory on general, but I assume that - on a physical machine - Linux will begin to swap if it sees that it is about to hit a physical memory limit. Does Linux handle the "effective" memory limit (be it cgroup limit or physical limit) the same way regardless of wether it runs inside a container or on a physical host?