tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Cloud Platforms > Google Cloud Platform (GCP) > Cloud Profiler

Cloud Profiler

Author: Venkata Sudhakar

Google Cloud Profiler is a statistical, low-overhead profiler that continuously gathers CPU usage and memory-allocation information from production applications. It helps you identify which functions consume the most resources without impacting performance.

Key Features:

1. Always-on profiling - Collects profiles continuously in production with less than 1% overhead.

2. Multiple profile types - CPU time, wall time, heap (RAM allocation), contention (lock wait), and threads.

3. Flame graphs - Visualize call stacks and resource consumption as interactive flame graphs.

4. Multi-language - Supports Java, Go, Python, Node.js, Ruby, and PHP.

5. Historical comparison - Compare profiles across different versions or time periods to detect regressions.

The below example shows how to enable Cloud Profiler in a Java application.


It gives the following output,

Cloud Profiler agent started
Profiling: my-service v1.2.0
Orders processed

Cloud Profiler UI shows:
Top CPU consumers:
  1. processOrders()     - 45.2% CPU
  2. Math.sqrt()         - 38.1% CPU
  3. GarbageCollector    - 8.3% CPU

Profile Types:

CPU time - Shows which functions are using the most CPU cycles. Best for optimizing compute-heavy code.

Heap - Shows which functions allocate the most memory. Best for finding memory leaks and GC pressure.

Wall time - Shows functions that take the most wall clock time including I/O waits. Best for finding slow I/O or blocking calls.


 
  


  
bl  br