Trying to know about LXC container memory usage? Here’s how we do it.
At Bobcares, we often receive requests to check about the LXC containers usage and other related as a part of our Server Management Services.
Today, let’s see how our Support Engineers help our customers in checking the memory consumption in the LXC container.
Monitoring LXC container memory usage
By default, the LXC container can use all the RAM of a server. However, we can limit the memory consumption. We can do that by setting a limit about how much RAM a container can use.
The below command helps in checking the information of a particular container.
lxc-info -n {container-name}
Using the command we can find the memory usage of the containers as well without logging into the container.
We use free -h command to check the right memory consumption when logged into the container.
Let us discuss how our Support Engineers change the memory limit for a particular container.
How we change the memory limit of a particular container?
Recently, one of our customers using LXC containers approached us to change the memory limit of the LXC container.
Let’s now see how our Support Engineers change the memory limit of a particular LXC container.
Initially, we can list the LXC containers in a server by running the below command,
lxc list
Here is the screenshot of the result.
Here we have one LXC container with the container name test.
We ran the below commands to check the memory usage of the test container to be 975M
lxc exec test free
Then we ran the following command to change the memory usage of the container.
lxc config set test limits.memory 256MB
Then finally, we checked if the changes have been reflected
This way we changed the memory limit of the LXC container.
[Need any assistance with LXC containers? – We’ll help you]
Conclusion
In short, using free inside an LXC container gives the memory usage information. Today, we saw how our Support Engineers check the memory usage of the LXC containers and change its limit as well.
0 Comments