Relation between CPUs and vCPUs in GCE - google-cloud-platform

Would like to know whether 1vCPU in GCE VM is equal to 1CPU.
On prem server has got 8CPUs and want to find equivalent server in GCE VM.
Should I opt for 8vCPUs or 16vCPUs?
Would be thankful if any Google documentation reference is provided.

As per this GCP documentation a vCPU is a single hardware hyper-thread on one of the CPU processors. For example, Intel Xeon processors Hyper-threading technology support multiple threads in a single physical core. You can configure an instance with one or more of these hyper-threads as vCPUs.
A physical CPU is actual hardware unit installed in motherboard socket. To calculate vCPU that is equivalent 8CPU to you can follow this doc.

Related

Fetch hardware details(Physical Ram, Number of Cores, Operating System) of a GCP CloudSql instance(CLOUD_SQL_INSTANCE)

I am writing Java code to retrieve the below info of an sql instance
Operating System, Number of Cores, Physical Ram. I tried API
gcloud sql instances describe <SQL_INSTANCE_NAME>
But, the relevant information was not useful

GCP machines with 1:2 ratio of cpu/ram

I was wondering if there are any machines on GCP that have 2x more ram than cpu ? I checked provided list by them but not seeing anything like in the ratio of 4vcpu 8gb ram, the available 2vcpu 8gb ram or 8vcpu 8gb ram is just a waste of resource for me atm https://cloud.google.com/compute/docs/machine-types
There are no such pre-defined instance types, but you can easily create a Custom machine type with the desired amount of RAM and number of CPUs.
Just pick up a Custom machine type while creating the instance and configure it as needed.
Here is an example of such a configuration in the Google Cloud Console web UI:
Also, please consider checking the respective docs to better understand the capabilities and restrictions of the custom machine types.

What is the number of cores in aws.data.highio.i3 elastic cloud instance given for a 14 day trial period?

I wanted to make some performance calculations hence i need to know the number of cores that this aws.data.highio.i3 instance deployed by elastic cloud on aws has, I know that it has 4 GB of ram so if anyone can help me with the number of cores that would be really very helpfull.
I am working on elasticsearch deployed on elastic cloud and my use case requires me to make approx 40 million writes in a day so if you can help me suggest what machines i must use that can work accordingly to my use case and are I/O optimized as well.
The instance used by Elastic Cloud for aws.data.highio.i3 in the background is i3.8xlarge, see here. That means it has 32 virtual CPUs or 16 cores, see here.
But you down own the instance in Elastic Cloud, from reference hardware page:
Host machines are shared between deployments, but containerization and
guaranteed resource assignment for each deployment prevent a noisy
neighbor effect.
Each ES process runs on a large multi-tenant server with resources carved out using cgroups, and ES scales the thread pool sizing automatically. You can see the number of times that the CPU was throttled by the cgroups if you go to Stack Monitoring -> Advanced and down to graphs Cgroup CPU Performance and Cgroup CFS Stats.
That being said, if you need full CPU availability all the time, better go with AWS Elasticsearch service or host your own cluster.

What vCPUs in Fargate really mean?

I was trying to get answers on my question here and here, but I understood that I need to know specifically Fargate implementation of vCPUs. So my question is:
If I allocate 4 vCPUs to my task does that mean that my
single-threaded app running on a container in this task will be able to fully use all this vCPUs as they are essentially only a
portion of time of the processor's core that I can use?
Let's say, I assigned 4vCPUs to my task, but on a technical level I
assigned 4vCPUs to a physical core that can freely process one
thread (or even more with hyperthreading). Is my logic correct for
the Fargate case?
p.s. It's a node.js app that runs session with multiple players interacting with each other so I do want to provide a single node.js process with a maximum capacity.
Fargate uses ECS (Elastic Container Service) in the background to orchestrate Fargate containers. ECS in turn relies on the compute resources provided by EC2 to host containers. According to AWS Fargate FAQ's:
Amazon Elastic Container Service (ECS) is a highly scalable, high performance container management service that supports Docker containers and allows you to easily run applications on a managed cluster of Amazon EC2 instances
...
ECS uses containers provisioned by Fargate to automatically scale, load balance, and manage scheduling of your containers
This means that a vCPU is essentially the same as an EC2 instance vCPU. From the docs:
Amazon EC2 instances support Intel Hyper-Threading Technology, which enables multiple threads to run concurrently on a single Intel Xeon CPU core. Each vCPU is a hyperthread of an Intel Xeon CPU core, except for T2 instances.
So to answer your questions:
If you allocate 4 vCPUs to a single threaded application - it will only ever use one vCPU, since a vCPU is simply a hyperthread of a single core.
When you select 4 vCPUs you are essentially assigning 4 hyperthreads to a single physical core. So your single threaded application will still only use a single core.
If you want more fine grained control of CPU resources - such as allocating multiple cores (which can be used by a single threaded app) - you will probably have to use the EC2 Launch Type (and manage your own servers) rather than use Fargate.
Edit 2021: It has been pointed out in the comments that most EC2 instances in fact have 2 hyperthreads per CPU core. Some specialised instances such as the c6g and m6g have 1 thread per core, but the majority of EC2 instances have 2 threads/core. It is therefore likely that the instances used by ECS/Fargate also have 2 threads per core. For more details see doco
You can inspect what physical CPU your ECS runs on, by inspecting the /proc/cpuinfo for model name field. You can just cat this file in your ENTRYPOINT / CMD script or use ECS Exec to open a terminal session with your container.
I've actually done this recently, because we've been observing some weird performance drops on some of our ECS Services. Out of 84 ECS Tasks we ran, this was the distribution:
Intel(R) Xeon(R) CPU E5-2686 v4 # 2.30GHz (10 tasks)
Intel(R) Xeon(R) Platinum 8124M CPU # 3.00GHz (22 tasks)
Intel(R) Xeon(R) Platinum 8175M CPU # 2.50GHz (10 tasks)
Intel(R) Xeon(R) Platinum 8259CL CPU # 2.50GHz (25 tasks)
Intel(R) Xeon(R) Platinum 8275CL CPU # 3.00GHz (17 tasks)
Interesting that it's 2022 and AWS is still running CPUs from 2016 (the E5-2686 v4). All these tasks are fully-paid On-Demand ECS Fargate. When running some tasks on SPOT, I even got an E5-2666 v3 which is 2015, I think.
While assigning random CPUs for our ECS Tasks was somewhat expected, the differences in these are so significant that I observed one of my services to report 25% or 45% CPU Utilization in idle, depending on which CPU it hits on the "ECS Instance Type Lottery".

Difference between 1 Shared vCPU and 1 vCPU

In GCP, what is the difference between an f1-micro instance (1 shared vCPU) vs. a n1-standard-1 (1 vCPU)? Specifically, what is the difference between a shared vCPU and a vCPU?
Shared-core machine types
Shared-core machine types provide one virtual CPU that is allowed to
run for a portion of the time on a single hardware hyper-thread on the
host CPU running your instance. Shared-core instances can be more
cost-effective for running small, non-resource intensive applications
than standard, high- memory or high-CPU machine types.
Source: https://cloud.google.com/compute/docs/machine-types#sharedcore
For your information, with one shared vCPU, Google doesn't guarantee it.