Introduction to Cloud Profiler

Lab Details:

  1. This lab walks you through Using Google Cloud Profiler.

  2. Duration: 60 minutes

Note: Do not refresh the page after you click Start Lab, wait for a few seconds to get the credentials.
In case while login into Google, if it asks for verification, please enter your mobile number and verify with OTP, Don't worry this Google Account will be deleted after the lab.

What is Cloud Profiler?

You can think of Cloud Profiler as an agent added to your code that gathers CPU usage and memory-allocation information from your production applications and send it to Monitoring Graphs in Google Cloud. As most the applications are not Monolithic today, you can add the agent to different microservices and it will help you identify the parts of the application consuming the number of resources and other performance characteristics of the code. Cloud Profiler creates a single profile by collecting profiling data, usually for 10 seconds, every 1 minute for a single instance of the configured service in a single Compute Engine zone. 

For every running production application, Cloud Profiler creates a separate profile. It collects Google Cloud Project, Application Name, Application Version, and Application Zone. When an agent is ready to capture a profile, it issues a Profiler API command to the Profiler backend. The backend receives this request and, immediately replies to the agent. The reply specifies the type of profile to capture. In response, the agent captures the profile and transmits it to the backend. Lastly, the Profiler backend associates the profile with your Google Cloud project.

The profile data is retained for a period of 30 days.

Why there is a Need for Cloud Profiler:

  1. Cloud Profiler is very Light-Weight and thus has near about no effect on the production application.

  2. Gathering Performace characteristics such as Memory-allocation, and CPU Cycles is a very difficult task in the Production environment as compared to the test environment, which the Cloud profiler performs very efficiently.

  3. You dynamically analyze your code and can make it efficient and faster in the Production environment.

Components of Cloud Profiler:

  1. Profiling agent: You install this agent on the virtual machines or where your application runs. The agent typically comes as a library that you attach to your application when you run it. 

  2. Profiler interface: After the agent has collected some profiling data, it displays all the data collected by it in a Frame Interface.

Types of Profiling offered by Cloud Profiler:

  1. CPU Time: It is the time for which the CPU was used for executing the code.

  2. Heap: The amount of memory allocated in the heap at the instant profile was created.

  3. Allocated Heap: The total amount of heap-allocated.

  4. Contention: In a multi-threaded program, the time spent waiting to serialize access to a shared resource can be significant.

  5. Threads: A thread is a single flow of tasks.

  6. Wall Time: It describes the total time used by code from entering to exiting. While executing a code there are various processes at the backend such as wait time(the process is in the queue) by the CPU.

Lab Tasks:

  1. Creating a VM Instance.

  2. SSHing into the VM and running the Node.js Application.

  3. Exploring Cloud Profiler.

Join Whizlabs_Hands-On to Read the Rest of this Lab..and More!

Step 1 : Login to My-Account
Step 2 : Click on "Access Now" to view the course you have purchased
Step 3 : You will be taken to our Learn Management Solution (LMS) to access your Labs,Quiz and Video courses

Open Console