LXC settings: Cores, CPU limit, CPU units

kamzata

Renowned Member
Jan 21, 2011
217
9
83
Italy
Can anyone explain me how to set these values in order to balance the load of every LXC Container?

I got 1 physical CPU with 6 cores and 12 threads.

What are some Cores, CPU limit, CPU units example values to share among the LXC Containers?
 
You can see what individual values do in our documentation.

For simple setups it is usually enough to only assign cores, as pvestatd will try to balance the load periodically anyway.
 
You can see what individual values do in our documentation.

For simple setups it is usually enough to only assign cores, as pvestatd will try to balance the load periodically anyway.

Thanks, really helpful. So, overlook CPU units, e.g. in order to let use "2 full CPUs" to a container I can set:
  • CPU core: 2
  • CPU limit: 2
which simply correspond to set only CPU core since CPU limit is set equal:
  • CPU core: 2
but e.g. if I want to let the container use "2 CPUs and consume like 1" I can set:
  • CPU core: 2
  • CPU limit: 1
Is that right?
 
Last edited:
Yes, your second example would allow the container to use up to 50% of the available cores, e.g. it would see 2, but when under load it might see one core at 100% and the other at 0%, or both at 50%.
 
  • Like
Reactions: kamzata
Hello,

so default value of CPU limit witch is "unlimited" means that if you set CPU core:2, LXC can user max 2 cores and max 100% to each other?

Example:
  • CPU core: 2
  • CPU limit: default value unlimited
Is the same as:
  • CPU core: 2
  • CPU limit: 2
Regards,
 
Hello,

so default value of CPU limit witch is "unlimited" means that if you set CPU core:2, LXC can user max 2 cores and max 100% to each other?

Example:
  • CPU core: 2
  • CPU limit: default value unlimited
Is the same as:
  • CPU core: 2
  • CPU limit: 2
Regards,

What about:
  • CPU core: 2
  • CPU limit: 4
?
 
Hello,

so default value of CPU limit witch is "unlimited" means that if you set CPU core:2, LXC can user max 2 cores and max 100% to each other?

Example:
  • CPU core: 2
  • CPU limit: default value unlimited
Is the same as:
  • CPU core: 2
  • CPU limit: 2
Regards,
Do I think right that both examples are the same?
 
Do I think right that both examples are the same?
Yes, they should perform the same. Easiest way to get a feeling for it is to set them and run stress --cpu $(nproc) in the CT, then observe the host with 'htop' or the like.

What about:
  • CPU core: 2
  • CPU limit: 4
?
I fit doesn't error out, it should do the same thing. Since one core can only perform up to 100%, the "CPU core" setting is the effective limiter.
 
  • Like
Reactions: MihaG

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!