XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Limit cpu of specific VM

    Scheduled Pinned Locked Moved Compute
    8 Posts 2 Posters 1.4k Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      rtjdamen
      last edited by

      Hi all,

      |I have a question where i don't seem to find a food answer for on the internet. On vmware we were able to limit a specific Virtual Machine on cpu usage, for instance if u have a vm with 8 cores active and it could use 24.000 ghz but in case of issues with cpu overusage u want to limit this to maximum 50% of the total capacity, you could give this vm a hard limit. I can't seem to find a setting on XCP-ng other then CPU Cap but i can't fuind much info about it. Anyone an idea how to do this?

      1 Reply Last reply Reply Quote 0
      • olivierlambertO Offline
        olivierlambert Vates 🪐 Co-Founder CEO
        last edited by

        You can reduce the number of vCPU or use CPU weight or cap for that 🙂

        R 1 Reply Last reply Reply Quote 0
        • R Offline
          rtjdamen @olivierlambert
          last edited by

          @olivierlambert in case u don't want to limit the number of vcpu but only set a hard maximum for the cpu the machine can use, i think i need cpu cap for that, i did some googling but can't seem to find the way this works, what do i need to set if i want to limit it 50%, is this 50 or do i need to set it to a maximum mhz just like vmware? and does the machine need a reboot for this to work? (i tried to set 50 as a value but that did not do anything on the machine)

          1 Reply Last reply Reply Quote 0
          • olivierlambertO Offline
            olivierlambert Vates 🪐 Co-Founder CEO
            last edited by

            It doesn't work on the frequency but with the way Xen schedules your CPU.

            You can modify the weight first:

            A domain with a weight of 512 will get twice as much CPU as a domain with a weight of 256 on a contended host. Legal weights range from 1 to 65535 and the default is 256.

            You can change that in the VM/Advanced view.

            The other setting is "cap", but it's a bit more complex:

            The cap, if set, fixes the maximum amount of CPU a domain will be able to consume, even if the host has idle CPU cycles. The cap is expressed in percentage of one physical CPUs: 100 is 1 physical CPU, 50 is half a CPU, 400 is 4 CPUs, etc. The default, 0, means there is no cap.

            R 1 Reply Last reply Reply Quote 0
            • R Offline
              rtjdamen @olivierlambert
              last edited by

              @olivierlambert ok so with a vm having 8 cores, i and i woulde like to physical limit it to the use of 4 cores i need to set cap to 400?

              1 Reply Last reply Reply Quote 0
              • olivierlambertO Offline
                olivierlambert Vates 🪐 Co-Founder CEO
                last edited by

                I would go for weight 128 so this VM will be scheduled twice less than the others on the physical machine where it runs.

                But I'm not sure to understand why not using 4 cores in the VM instead of just 8? What's the use case?

                R 1 Reply Last reply Reply Quote 0
                • R Offline
                  rtjdamen @olivierlambert
                  last edited by

                  @olivierlambert in this case, and we see this more there is an application running on this machine thats is having a cpu leak, we asked the customer to fix this but they lack to, as this kind of vm's cause overusage on the host server we would like to hard limit them so they do not cause issues. this is where cpu cap can help.

                  1 Reply Last reply Reply Quote 0
                  • olivierlambertO Offline
                    olivierlambert Vates 🪐 Co-Founder CEO
                    last edited by

                    Okay then try CPU cap at 400 🙂

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post