CPU allocation questions
Ok, so perusing various VPS sales I see statements like this fairly often: "1 vCPU (25% cpu alocated) (please don t abuse cpu and don t usage cpu every time 100% , maximum 40 minutes per day for 100%)." That particular one is taken from the iHostART thread but I could've picked several. This makes me wonder a few things as a fairly recent VPS addict enthusiast:
- On most VPS systems, unless stated otherwise, does 1 CPU/vCPU/Core/vCore mean the same thing? I presume since it's a VPS, you're not getting a full core unless it says so.
- Without finding it in their AUP/TOS (which seems to be easier for some providers than others, in my limited experience), what should I assume is the % use allowed?
- If a VPS offers things like say, "3 vCores" does that mean you get 3x the allowance of a single core, so like 25% becomes 75%? Or does that mean 3 cores at 25% each? Or something else?
- How exactly does one measure or at least estimate CPU usage?
- What types of activities would tend to use up a ton of CPU on a regular basis? I have seen a few comments about compiling causing high usage, but unless it's a dev server, compiling wouldn't happen that often, right? But what else?
Any other comments or whatnot welcome, so long as it has something to do with CPUs and VPS! I await wisdom.
Comments
rule of thumb, any vps is a shared cpu with fair share allocation, you are best off reading their AUP's etc to see if they have limitations on usage.
if you want dedicated cpu cores, you will need to pay the premium to get the dedicated core, a lot of providers will have offers for dedicated cores
the addition of multiple cores on a fair-share cpu plan will have small bursts in your activities, say it being database lookups, or even the need to compile things from time to time, this style usage normally should not impact on the server and cause suspensions.
if you are looking to mine crypto using a fair-share vps, you will more than likely get suspended within a few hours of starting it up.
I have a few netcup root-servers with dedicated cores for x265 encoding and they run lovely, but I would not attempt to even try that on a fair-share plan.
In general a "vCPU' or even "core" in VPS speak just means thread, not a core. So a 16 core, 32 thread machine will have 32 vCPU. That will often be upsold 2x or more, so they might have 64 customers buying 1 vCPU on that machine, so obviously if everyone maxed out their usage, it'd be a problem, but if people only use 50% then it's fine. When you see a limit like 25%, it could mean that they've sold 128 vCPU for their 16 core machine.
Now, the real truth is that most customers don't need anywhere near the resources they buy, so most of the time they might be using 5% but occasionally need to use 100% for a short time. As long as everyone's short time of 100% doesn't overlap, it's not a problem for anyone, because there's spare capacity if most people are only using 5%.
Now if 16 of your 128 people use it at 100%, then you have all your cores doing something. In theory, the CPU has 16 more threads, in practice each core and 2 threads share a lot of resources, so the throughput is anywhere between 1.0x and 2.0x of a single thread. So, 15% of users at 100% CPU can easily ruin the experience for the other 85% of customers.
Some companies sell dedicated resources, often called VDS, although some providers also use that term for a non-dedicated VPS. So, if you by 2 dedicated vCPU, they are locked to a single core (so maybe only about the real-word performance of 1 vCPU on a VPS) but the advantage is you can use it all, and not worry about everyone else. It also means that your use is immediate when you need it, because your core is guaranteed to be idle.
RAM tends not to be oversold on a VPS, because there are serious performance issues for everyone if RAM is oversold, and it's usually cheap enough to do it properly.
Network and disk IO are also shared resources, so other people's excessive use will affect you. For most people, in real world use, this isn't too much of an issue though.
It's simple, because many servers have a RAM:Core ratio even higher than 16:1. If you have two 1vCPU 1GB VPS and exhausting one core, what about the remaining 14 1GB VPS? That's why I likes 5950x, It can only be configured with 128GB of RAM, which is a maximum of 8:1 RAM:Core ratio
For example, php-friends has made public the hardware they use, https://php-friends.de/vserver-ssd/hostsysteme. 6140/6240 only have 18cores, that's 1024GB / 36core
RAM capacity (how much data you can store in the RAM, measured in MiB) is not oversold.
RAM bandwidth (how much data you can read from or write to RAM, measured in GT/s) can be oversold.
Webhosting24 aff best VPS; ServerFactory aff best VDS; Cloudie best ASN; Huel aff best brotein.
So how would I measure or estimate my usage ?
top
is easiest and installed by default on most systemsWith
top
does it show cpu % based on my own allocation, or in general? I tried on one of my VPS and it was floating around 30-35% most of the time. I've also seen the commandhtop
, I presume that is similar?It's the percentage of your virtualised CPU; 35% constantly is ... pretty busy tbh. I'll spike to close on 100% for a few minutes for big heavyweight daily jobs (like backups), but the background on any of my servers doesn't come close to that.
If you're actually averaging 35% CPU then you're probably sailing close to (or over) the 'abuse' line on a lot of low end providers (and you're probably not popular with your neighbours, either)
Thanks, that's good to know it's from my virtual CPU and not the whole. And I realized I worded that poorly, it was 30-35% most of the time that I was doing stuff on the VPS! That one usually sits idle, lol, but I will manually do some rclone transfers or compression on it from time to time.
Things like Zabbix (other monitors are avaiable!) will give you an insight into your CPU usage over time (along with... lots of other metrics) which can be useful in spotting your general resource requirements.
Tools like top are great for a snapshot, but less helpful at getting a feel for longer term usage.