Idle CPU utilization on Google Compute Engine - google-cloud-platform

Is there a reason why Google Developer Console shows 4-5% CPU utilization for my idle Debian Linux VM even though the VM itself claims it is 100% idle?

The CPU usage in Google Cloud Console is not that of the instance, but the CPU usage of the container managing it. This container is in charge of providing the virtualization services to the instance and collecting all the metrics. So, the Google Cloud Console CPU utilization shows the aggregate CPU usage for both the container and the instance.

Related

In GCP , I can able to view GKE Monitoring dashboard. How to create alerts for CPU and memory Utilization for Kubernetes Container

I have enabled Default GCP Monitoring in my Google Kubernetes Cluster. So GKE Dashboard is created which contains System Metrics. Now I need to enable alert for Kubernetes container's CPU and memory Utilization from GKE dashboard. I tried to create own alert, but it didn't match with metrics defined in GKE dashboard.
This is a Guide1 and Guide2 for monitoring the Kubernetes engine. In it, you can know about alerting and how to monitor your system. In case you were already familiar, here is a list of the metrics for the new Kubernetes engine in comparison to the previous metrics. Additionally, the complete list of metrics, which are always useful, can be found here.
In Monitoring dashboard, dashboard displays CPU and Memory utilization in time range:
CPU utilization: The CPU utilization of containers that can be attributed to a resource within the selected time span. The metric used is here check with For CPU Utilization
Memory utilization: The memory utilization of containers that can be attributed to a resource within the selected time span. The metric used is here check with For Memory Utilization
The command "kubectl top node" displays resource (CPU/Memory/Storage) usage at that moment, not time span.

Windows application performance deteriorates in EC2 instance created by custom AMI

I have created a Windows custom AMI with some custom Windows application.I use this AMI to generate EC2 instances.
I have run into a strange issue:
All the applications run smoothly in the EC2 instance created from the custom AMI.
However, after 24 hours, when I created an EC2 instance using the same custom image, the performance of the applications deteriorate.
Even opening an application on the EC2 instance is much slower compared to the EC2 instance which was created 24 hours prior.
Any Suggestions would be really helpful.
This might be caused by the use of a T2 instance. These are burstable instances.
From CPU Credits and Baseline Performance for Burstable Performance Instances - Amazon Elastic Compute Cloud:
Traditional Amazon EC2 instance types provide fixed performance, while burstable performance instances provide a baseline level of CPU performance with the ability to burst above that baseline level. The baseline performance and ability to burst are governed by CPU credits. A CPU credit provides the performance of a full CPU core for one minute.
So, if your Amazon EC2 instance is consuming a lot of CPU, then it might run out of the CPU credit balance, and therefore be limited in the amount of CPU it can use.
You can monitor the CPU credit balance in Amazon CloudWatch. You can also see the historical CPU usage in CloudWatch, or do it within the Windows instance itself using the Task Manager.
I got the issue. Apparently any windows app we launch , Microsoft automatically tries to connect to internet for updates for every 24 hours . In my case , Internet was turned off , The updates where not getting downloaded. hence the connection was in wait state of 15 seconds by default, Hence the application was slow to launch

How to monitor Nvidia GPU computation/memory usage on GCP Stackdriver?

I am trying to monitor Nvidia GPU computaion/memory usage on Google Cloud Platform.
CPU usage can be monitored by default at the GCP web console, but I need Stackdriver agent to monitor RAM usage (as far as I know).
My compute engine instance has (preemptive) GPU(s).
I could get the current GPU usage by running nvidia-smi command, but I have no idea how to let stackdriver know these metrics.

How does Google bill for compute engine?

I am currently running the free trial with 300$ credit.
There's one instance present in the console. Does Google bill for 'running' the instance or 'connecting' it to SSH?
Google charges compute instances by the time they're running (started) according to CPU and RAM, there are additional charges for disks and network. There are discounts for long running instances and for commitments. pricing information is available at https://cloud.google.com/compute/pricing
You can start and stop instances any time and it depends on your workload... for your use-case of compiling things you may use preemptible instances which are much cheaper - https://cloud.google.com/preemptible-vms/

How to increase AWS EC2 instance CPU utilization to 100% to test autoscaling group creating new instances?

I need to test autoscaling group creating new instances when CPU utilization cross certain threshold for example 70%.
Is there any way to up the CPU utilization just to test?
You can use stress command in Linux:
stress --cpu 2 --timeout 60
cpu specifies the number of cores, timeout specifies the number of seconds this command will run.
For Windows:
Install Windows Server 2003 Resource Toolkit.
Then run this command in cmd:
consume -cpu-time -time 5
If you are testing a web based application, I recommend you try Bees With Machine Guns.
Its a python script that will launch micro EC2 instances and send many web requests from these instances to your application. This will simulate a large surge in traffic for performance testing.
Note the caveat at the bottom of the page that says:
If you decide to use the Bees, please keep in mind the following important caveat: they are, more-or-less a distributed denial-of-service attack in a fancy package and, therefore, if you point them at any server you don’t own you will behaving unethically, have your Amazon Web Services account locked-out, and be liable in a court of law for any downtime you cause.
You have been warned.
Another way to bring CPU utilization up on Posix systems is to use the stress command. Stress generates CPU, memory, I/O or disk workload depending on your configuration.
An example answer here shows how to use stress to bring the memory of an instance to 90%.