Pyroscope
Continuous profiling platform for performance optimization and debugging and alternative to Datadog Continuous Profiler.
Why consider Pyroscope?
Pyroscope is an open-source continuous profiling platform by Grafana Labs. It pinpoints CPU, memory, and I/O performance bottlenecks down to the exact line of code.
Learn Pyroscope by building
Practical setup notes, real use cases, and copy-ready examples in one focused guide.
In this guide11 sections
What is Pyroscope?
Pyroscope is an open-source, continuous profiling platform developed by Grafana Labs. It operates as a high-efficiency, on-premises alternative to proprietary cloud profiling services like Datadog Continuous Profiler and Google Cloud Profiler.
Pyroscope continuously records and aggregates application profiling data—CPU utilization, memory allocations, goroutine/thread states, mutex lock contention, and disk I/O—across production workloads with minimal runtime overhead (typically < 1%). It renders interactive Flame Graphs that let developers pinpoint the exact functions and lines of source code consuming resources.
Who Is It For?
- Backend & Systems Engineers: Pinpointing memory leaks, excessive garbage collection, and CPU bottlenecks in production services.
- Platform & Infrastructure Teams: Optimizing compute infrastructure costs by identifying inefficient microservice code paths.
- Performance Architects: Comparing flame graph profiles between application versions to verify performance optimizations.
Key Features
- Multi-language continuous profiling: Native SDK agents for Go, Python, Java, Node.js, Ruby, Rust, .NET, and eBPF (kernel level).
- Interactive Flame Graph visualizer: Zoom, search, filter, and inspect hierarchical stack traces with millisecond precision.
- Differential flame graphs: Compare two profiling time ranges or software releases side-by-side to highlight regressions.
- Seamless Grafana integration: Query and embed Pyroscope flame graphs directly in Grafana dashboards.
- Ultra-low overhead profiling engine with scalable, multi-tenant distributed object storage (S3/GCS/MinIO).
Deploying Pyroscope with Docker Compose
version: '3.7'services: pyroscope: image: grafana/pyroscope:latest container_name: pyroscope restart: unless-stopped ports: - "4040:4040" volumes: - ./data:/var/lib/pyroscopeStart the container:
docker compose up -dOpen http://localhost:4040 in your browser to view the interactive Pyroscope continuous profiling dashboard.
Instrumenting a Python Application
pip install pyroscope-ioInitialize Pyroscope in your application entrypoint:
import pyroscopepyroscope.configure( application_name = "my-backend-service", server_address = "http://localhost:4040")Practical Use Cases
1. Production Memory Leak Identification
An engineering team detects a slow memory leak in a Python worker; Pyroscope heap allocation flame graphs immediately highlight a caching dictionary that never purges expired keys.
2. Side-by-Side Release Regression Analysis
A team compares flame graphs before and after a major software release, discovering that a new JSON serialization library increased CPU usage by 35%.
3. Kernel-Level eBPF Profiling Without Code Changes
An SRE deploys the Pyroscope eBPF agent on a Kubernetes cluster, profiling all running containers without modifying application source code.
Troubleshooting and Limitations
- Symbolication for Compiled Binaries: For C++, Rust, or Go binaries, compile with debug symbols enabled (
-g) to ensure function names appear correctly in flame graphs. - Storage Retention: Pyroscope compresses profile trees efficiently; configure chunk retention policies in
pyroscope.yamlto manage long-term storage growth.
Official Resources
- Official Website: https://grafana.com/oss/pyroscope/
- GitHub Repository: https://github.com/grafana/pyroscope
- Documentation: https://grafana.com/docs/pyroscope/latest/
Related tools
More options with a similar category or technology profile.
diskus
Minimal, fast alternative to du -sh written in Rust using multi-threaded directory traversal.
peco
Simplistic interactive filtering tool for Unix pipelines, process lists, and file trees.
Dapr CLI
Command-line tool for managing Dapr distributed application runtime environments and sidecars.
Freeze
Generate beautiful image screenshots and SVGs of code snippets and terminal outputs.