LXC CPU Isolation

aleksa

New Member
Oct 20, 2021
13
0
1
24
Hi,

I've been using LXC for a while now, though I've noticed two things:
- Load Average is not the container load average, instead its host
- Reported CPU usage (inside of the container, with tools like htop and vmstat) are not of the container itself, instead the host core that it was assigned to

I'm aware that LXC is not full virtualization/isolation, like QEMU, though I'm still curious of the possibility for such stuff.

As far as I know, the load average can be "fixed" with a startup parameter, but got no clues as to the reported cpu usage, and if its even possible.

So my question is:
Is it possible to isolate CPU usage inside of a LXC container, so that it reports only its own?
If it is possible, is it possible inside of Proxmox?

Thank you in advance!
 
- Load Average is not the container load average, instead its host
- Reported CPU usage (inside of the container, with tools like htop and vmstat) are not of the container itself, instead the host
LXC already virtualize those things if you read the values using /proc file system (some tools do that).

All tools directly using kernel syscalls gets the values from the host.
 
LXC already virtualize those things if you read the values using /proc file system (some tools do that).

All tools directly using kernel syscalls gets the values from the host.

Hm, okay.
I was mainly looking at isolating tools like htop, vmstat and uptime monitors like HetrixTools, though they do seem to use the syscalls so I guess they won't read the container specific values - Bit of a bummer...

Thanks for your response, will keep that in mind.
 
A while ago I found this post:
https://forum.proxmox.com/threads/lxc-loadavg.44463/post-239269

If I understand it right then CPU/RAM usage of the LXC and not of the host should be reported. But didn't tried it myself yet.
I really wonder why this hasn't beed added to PVE yet, because that "-l" flag was added 2 years ago. Would make it so much easier to run monitoring tools like zabbix inside the LXCs.
 
  • Like
Reactions: tuxillo

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!