Dear all, I am not clear about the 'vcpu' element for CPU allocation. I allocated 1 vCPU to my container, after I started the container, I ran 4 computation-intensive tasks on the container. And I found all the 4 physical core are 100% used (my host has 4 physical cores and no other application ran on the host except the container). That is, all available cores were used by the container. I want to know how to give a hard limitation for CPU usage of a container. So I don't understand what 'vcpu' setting can be used for. I know that another CPU allocation element 'shares' can also be used, but this elements only give a relative quota. If new containers are started, the CPU quota for the already started containers will change. Regards, Cheng
Hi, I'm not libvirt expect. My guess is that some vcpu settings only apply to KVM/qemu backend. LXC is quite different from them. If setting vcpu# is not effective for LXC container, you may need to use cgroups. -- Thanks, Yuanle On Mon, Mar 17, 2014 at 2:32 PM, WANG Cheng D < Cheng.d.Wang@alcatel-sbell.com.cn> wrote:> Dear all, > > I am not clear about the 'vcpu' element for CPU allocation. I allocated 1 > vCPU to my container, after I started the container, I ran 4 > computation-intensive tasks on the container. And I found all the 4 > physical core are 100% used (my host has 4 physical cores and no other > application ran on the host except the container). That is, all available > cores were used by the container. I want to know how to give a hard > limitation for CPU usage of a container. > > So I don't understand what 'vcpu' setting can be used for. > > I know that another CPU allocation element 'shares' can also be used, but > this elements only give a relative quota. If new containers are started, > the CPU quota for the already started containers will change. > > Regards, > > Cheng > > _______________________________________________ > libvirt-users mailing list > libvirt-users@redhat.com > https://www.redhat.com/mailman/listinfo/libvirt-users >
Dear yuanle, Thank you for the information. You might be right. But I am still confused about what’s the difference between a vCPU and a physical core. Regards, Cheng From: sylecn [mailto:sylecn@gmail.com] Sent: 2014年3月17日 15:06 To: WANG Cheng D Cc: libvirt-users@redhat.com Subject: Re: [libvirt-users] a question on vCPU setting for lxc Hi, I'm not libvirt expect. My guess is that some vcpu settings only apply to KVM/qemu backend. LXC is quite different from them. If setting vcpu# is not effective for LXC container, you may need to use cgroups. -- Thanks, Yuanle On Mon, Mar 17, 2014 at 2:32 PM, WANG Cheng D <Cheng.d.Wang@alcatel-sbell.com.cn<mailto:Cheng.d.Wang@alcatel-sbell.com.cn>> wrote: Dear all, I am not clear about the ‘vcpu’ element for CPU allocation. I allocated 1 vCPU to my container, after I started the container, I ran 4 computation-intensive tasks on the container. And I found all the 4 physical core are 100% used (my host has 4 physical cores and no other application ran on the host except the container). That is, all available cores were used by the container. I want to know how to give a hard limitation for CPU usage of a container. So I don’t understand what ‘vcpu’ setting can be used for. I know that another CPU allocation element ‘shares’ can also be used, but this elements only give a relative quota. If new containers are started, the CPU quota for the already started containers will change. Regards, Cheng _______________________________________________ libvirt-users mailing list libvirt-users@redhat.com<mailto:libvirt-users@redhat.com> https://www.redhat.com/mailman/listinfo/libvirt-users