That's right, a vCPU is a shared resource.
Lets say that you had a machine with 4 cores on it. To the operating system, other than some nuances with the cache, PCI connections, etc., each core is effectively its own CPU, and therefore we'll say the machine has a total of 4 CPUs. Now, just becuase it has 4 CPUs doesn't mean that you can only run 4 programs at a time; you can run hundreds or thousands of programs at the time time, and the operating system will schedule those to run on the CPUs. Each program will get some CPU time, more so if other processes aren't doing much.
Now, think of each vCPU as a process running on the host machine. The host machine will time share those vCPUs across the actual CPUs just like any other process running on the machine. But, within the virtual environment, it is seen as a real CPU to the guest operating system, and it will schedule programs to run on that CPU accordingly.
So, you effectively have two layers of scheduling happening.
There's not necessarily a limit on the number of vCPUs, just as there's not necessarily a limit on the number of processes that you can run. Yes there are technical limits on the number of processes that can be run, but that's an operating system limitation.
Now, you can assign a vCPU to have exclusive use of a CPU on the host system, however unless you have some critical application where that's an absolute must, it's really not necessary; you're just slowing down every other process on that machine as they're no longer able to use that CPU when nothing else is using it.
Now, if your machine is super busy and you have virtual machines competing for time, then you have what's called "steal time" or "CPU Steal", which is the amount of time a vCPU waits for control of a real CPU; you can read about that here:
https://blog.appsignal.com/2021/09/15/cpu-steal-time-a-crucial-metric-for-cloud-servers-and-vms.html. But if that becomes a problem, you're overloading your system and it doesn't really matter how many threads your host system has.
On Thu, Jul 20, 2023, at 12:59 PM,
techlists@phpcoderusa.com wrote:
> On 2023-07-20 10:55, Ryan Petris wrote:
> > The CPU's cheap because it's old and no one wants them anymore -- it's
> > of the same generation as 6000 series intel processors (i.e. skylake).
> > It also uses a server socket, so the only motherboards you're going to
> > be able to find are server motherboards. Those are going to be
> > expensive and/or have other quirks, such as requiring a vendor
> > specific heatsink, or a vendor-specific power supply, or take 5
> > minutes to start up, etc.
> >
> > You'd be better off spending money on a last-gen cpu and motherboard,
> > for instance here's a combination that is relatively cheap:
> >
> > $174 for an i5-12400, which according to cpubenchmark.net is nearly
> > 30% faster than the Xeon you linked (score of 19501 vs 15146, much
> > faster single-core score as well):
> > https://www.amazon.com/Intel-i5-12400-Desktop-Processor-Cache/dp/B09NMPD8V2/
> >
> > $139 for a compatible motherboard:
> > https://www.amazon.com/GIGABYTE-B760M-DS3H-AX-Motherboard/dp/B0BSP61QZC/
> >
> > I also wouldn't pay so much attention to the number of "threads" you
> > think you'll need; you can run many VMs with a total number of virtual
> > processors that is much more than what you actually have, and as long
> > as you're not trying to go whole hog on every machine at the same time
> > you'll be fine, and even if you do, you'll still be better off with a
> > faster processor with a few fewer threads than an older slower cpu
> > with more.
>
> ---
>
> Several months ago I did some research on what a vCPU is. I could not
> find an exact answer. What I came away thinking was a vCPU is equal to
> a thread. From what you are saying it sounds like a vCPU is a shared
> resource, so there may be more vCPUs than actual threads? Is there a
> way I can determine the number of vCPUs a CPU will provide?
>
>
> ---
>
> >
> > On Thu, Jul 20, 2023, at 10:26 AM, Keith Smith via PLUG-discuss wrote:
> >
> >> Hi,
> >>
> >> I was surfing the Inter Web when I happened upon a Xeon server CPU.
> >> It
> >>
> >> is marked at $32.49 at Newegg. It has 12 cores and 24 threads and
> >> has a
> >>
> >> good benchmark score.
> >>
> >>
> > https://www.cpubenchmark.net/cpu.php?cpu=Intel+Xeon+Silver+4116+%40+2.10GHz&id=3179
> >>
> >> https://www.newegg.com/p/274-000A-007K2?Description=Xeon
> >>
> >> In the future at some point I would like to build something with 20
> >> plus
> >>
> >> or minus cores and 40 threads more or less for Proxmox. This would
> >> be
> >>
> >> over kills because I only need 1 or 2 VMs active at one time...
> >> maybe 3
> >>
> >> in an extreme situation.
> >>
> >> This 12 core/24 thread CPU with 64Gb of Ram and a 1Tb SSD would
> >> really
> >>
> >> be more resources than I would ever need. Off the top of my head
> >> this
> >>
> >> means I might be able to build a decent Proxmox server for $500 -
> >> $600.
> >>
> >> I do not need fancy video except for one VM that might be running
> >> Win 10
> >>
> >> or 11... I assume a server grade CPU would handle Win 10 and 11?
> >>
> >> Am I on the right track?
> >>
> >> Thank You For Your Feedback!!
> >>
> >> Keith
> >>
> >> ---------------------------------------------------
> >>
> >> PLUG-discuss mailing list: PLUG-discuss@lists.phxlinux.org
> >>
> >> To subscribe, unsubscribe, or to change your mail settings:
> >>
> >> https://lists.phxlinux.org/mailman/listinfo/plug-discuss
>
---------------------------------------------------
PLUG-discuss mailing list:
PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
https://lists.phxlinux.org/mailman/listinfo/plug-discuss