Optimizing performance and cost · Topic 1 of 2

Application Performance Monitoring and Active Assist Recommendations

Collect performance data with Cloud Monitoring, Cloud Trace and Cloud Profiler, and act on Active Assist insights, recommenders and rightsizing advice.

  • 4 min
In a nutshell
  • APM: Monitoring detects, Trace locates, Profiler pinpoints code, Error Reporting groups exceptions.
  • Measure latency as percentiles, not averages.
  • Active Assist recommenders produce insights and recommendations with estimated impact.

What it is

Application performance monitoring (APM) means measuring how fast and how well an application serves users, and where it spends its time and resources. On Google Cloud, APM is a set of tools that work together: Cloud Monitoring, Cloud Trace, Cloud Profiler and Error Reporting.

Active Assist is Google Cloud's family of tools that analyze your usage and suggest improvements, through recommenders that produce insights and recommendations.

Cloud Monitoringlatency, saturationCloud Traceslow callsCloud Profilerhot codeActive AssistrecommendationsApply changemeasure again

How it works

APM tools on Google Cloud

ToolAnswersOverhead
Cloud MonitoringIs performance getting worse? Latency percentiles, error rates, utilization, saturationPlatform metrics are automatic
Cloud TraceWhich service or call in a request is slow?Sampled traces
Cloud ProfilerWhich functions use the most CPU, wall time or memory?Low, designed to run continuously in production
Error ReportingWhich exceptions are new or growing?Reads errors from logs
Application MonitoringHow are the services of one application doing together?Uses App Hub applications

Use the golden signals for each service: latency, traffic, errors and saturation. Measure latency as percentiles such as p50, p95 and p99; averages hide the slow requests users notice.

Cloud Profiler

Cloud Profiler collects profiles from running code and shows flame graphs, where wide bars are functions that use the most resources. It supports common languages including Go, Java, Node.js and Python.

import googlecloudprofiler

googlecloudprofiler.start(service="checkout", service_version="1.4.2")

Comparing profiles between two versions shows exactly which change increased CPU or memory, which is useful for both performance and cost.

Active Assist insights and recommendations

TermMeaning
RecommenderA service that analyzes one area, such as VM machine types
InsightAn observation about usage, such as "this VM averaged 8% CPU for 30 days"
RecommendationA suggested action, such as "change to a smaller machine type", with estimated impact
StateActive, claimed, succeeded, failed or dismissed, so teams track what was done

Recommendations appear in the console next to the resource and together in the Recommendation Hub, and can be listed with gcloud or the API, or exported to BigQuery for reporting across the organization.

Google Cloud recommenders by category

CategoryExamples
CostVM rightsizing, idle VMs, idle persistent disks, unused IP addresses, committed use discount recommendations, idle Cloud SQL instances
SecurityIAM role recommendations that remove unused permissions
PerformanceMachine type changes for overloaded VMs
ManageabilityConfiguration improvements, such as for GKE clusters
ReliabilitySettings that reduce outage risk
gcloud recommender recommendations list \
  --project=shop-prod --location=europe-west1-b \
  --recommender=google.compute.instance.MachineTypeRecommender

Recommendations are based on observed usage. Check a recommendation against known peaks, such as month-end jobs, before applying it.

Acting on recommendations safely

  • Apply in non-production first, or to a canary group of VMs.
  • Change VM machine types during a maintenance window, because a resize needs a stop and start.
  • Make the change in IaC so the next apply does not undo it.
  • Mark the recommendation as claimed and then succeeded so the team knows it is done.
  • Export recommendations to BigQuery and report savings by team.

A worked example

A finance review asks the SRE team to cut Compute Engine spend without hurting latency. Active Assist shows 30 VMs with machine type recommendations and 12 idle persistent disks.

The team checks Cloud Monitoring for peaks, confirms p99 latency headroom, and applies the smaller machine types to staging first. They change the Terraform machine types for production, delete the idle disks after taking snapshots, and mark each recommendation succeeded.

Recommendation HubCheck peaksCloud MonitoringStaging firstTerraform changeproductionMark succeeded

How the exam asks about this

  • "Find which function in a Java service causes high CPU in production, with minimal overhead." Use Cloud Profiler.
  • "Identify VMs that are over-provisioned across all projects." Use the machine type recommender in Active Assist, and export recommendations to BigQuery for the organization view.
  • "Remove permissions that users have not used in 90 days." Apply IAM role recommendations.

What to remember for the exam

  • APM: Monitoring detects, Trace locates, Profiler pinpoints code, Error Reporting groups exceptions.
  • Measure latency as percentiles, not averages.
  • Active Assist recommenders produce insights and recommendations with estimated impact.
  • Categories: cost, security, performance, manageability, reliability.
  • Validate recommendations against peaks, apply through IaC, track their state.
Watch out

Rightsizing advice is based on recent usage. A VM that is idle for most of the month but critical at month-end can be undersized by a blind recommendation.

Common mistakes

Using average latency. A good average can hide a terrible p99. Track percentiles.

Applying recommendations by hand in the console. IaC then reverts them. Change the code.

Treating Error Reporting as a profiler. It groups exceptions; CPU and memory hot spots need Cloud Profiler.

Check yourself

  • What is the difference between an insight and a recommendation?

    An insight is an observation about usage or configuration, while a recommendation is a suggested action with an estimated impact.

  • Which tool shows which code path uses the most memory in production?

    Cloud Profiler, through its heap and allocation profiles shown as flame graphs.

  • How can you report recommendations across the whole organization?

    Export recommendations and insights to BigQuery and query or chart them there.

Topic 1 of 2 in Optimizing performance and cost

Test yourself on Optimizing performance and cost

The full Google Cloud Professional Cloud DevOps Engineer question bank has 751 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Google Cloud. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.