nerdexam
Google

PROFESSIONAL-CLOUD-DEVELOPER · Question #223

You recently deployed a Go application on Google Kubernetes Engine (GKE). The operations team has noticed that the application's CPU usage is high even when there is low production traffic. The operat

The correct answer is D. Modify your Go application to capture profiling data. Analyze the CPU metrics of your application. Go has built-in pprof profiling support. By instrumenting the application to expose profiling data (via net/http/pprof or the Cloud Profiler Go agent), Cloud Profiler can continuously collect CPU profiles and display a flame graph that shows exactly which functions and call paths

Debugging and Performance Optimization

Question

You recently deployed a Go application on Google Kubernetes Engine (GKE). The operations team has noticed that the application's CPU usage is high even when there is low production traffic. The operations team has asked you to optimize your application's CPU resource consumption. You want to determine which Go functions consume the largest amount of CPU. What should you do?

Options

  • ADeploy a Fluent Bit daemonset on the GKE cluster to log data in Cloud Logging. Analyze the logs
  • BCreate a custom dashboard in Cloud Monitoring to evaluate the CPU performance metrics of your
  • CConnect to your GKE nodes using SSH. Run the top command on the shell to extract the CPU
  • DModify your Go application to capture profiling data. Analyze the CPU metrics of your application

How the community answered

(40 responses)
  • A
    8% (3)
  • B
    15% (6)
  • C
    5% (2)
  • D
    73% (29)

Explanation

Go has built-in pprof profiling support. By instrumenting the application to expose profiling data (via net/http/pprof or the Cloud Profiler Go agent), Cloud Profiler can continuously collect CPU profiles and display a flame graph that shows exactly which functions and call paths consume the most CPU - down to individual function names. This gives actionable, function-level visibility. Fluent Bit and Cloud Logging (A) capture log lines, not CPU call stacks. A Cloud Monitoring dashboard (B) shows aggregate node/container CPU metrics but cannot attribute usage to specific Go functions. The top command over SSH (C) shows process-level CPU for the entire container, not individual function breakdowns.

Topics

#Go Profiling#Performance Optimization#Debugging#GKE Application Development

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVELOPER Practice