https://github.com/allegro/envoy-perf-pprof
Convenient Envoy on-CPU performance analysis with perf and pprof.
https://github.com/allegro/envoy-perf-pprof
cpu envoy perf pprof profiling
Last synced: 6 months ago
JSON representation
Convenient Envoy on-CPU performance analysis with perf and pprof.
- Host: GitHub
- URL: https://github.com/allegro/envoy-perf-pprof
- Owner: allegro
- License: apache-2.0
- Created: 2021-03-05T14:11:43.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-22T18:40:26.000Z (over 3 years ago)
- Last Synced: 2025-04-11T23:49:28.783Z (6 months ago)
- Topics: cpu, envoy, perf, pprof, profiling
- Language: Dockerfile
- Homepage:
- Size: 493 KB
- Stars: 13
- Watchers: 3
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# envoy-perf-pprof
> Convenient Envoy on-CPU performance analysis with perf and pprof.
`envoy-perf-pprof` takes `perf` data collected for an Envoy process and launches [pprof](https://github.com/google/pprof/) for it.
Takes care of installing required dependencies in Docker and handling Envoy symbolization.## Example
Call `./envoy-perf-pprof.sh v1.17.0 example/example.perf` to play with an example profile.

## Usage
### Collect `perf` data
Run `perf` on the machine running an official Envoy binary, e.g. a 10 minutes profile, as described
in [Envoy docs](https://github.com/envoyproxy/envoy/blob/main/bazel/PPROF.md#on-cpu-analysis):```bash
$ perf record -F 49 -g -o /tmp/envoy.perf -p -- sleep 600
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.694 MB /tmp/envoy.perf (1532 samples) ]
```### Analyse with `envoy-perf-pprof`
Execute `./envoy-perf-pprof.sh` with profiled Envoy version and perf data file as arguments, e.g.:
```bash
$ ./envoy-perf-pprof.sh v1.17.0 envoy.perf
(...)
Serving web UI on http://0.0.0.0:8888
```Open the link in the browser to access [pprof](https://github.com/google/pprof/) web UI.
The first run will take a few of minutes as it builds the Docker image: installs dependencies and
downloads proper Envoy version with debug symbols retained.## Alternatives
Instead of profiling with `perf` and `envoy-perf-pprof` you can compile Envoy with `gperftools` by yourself and use it instead of the official binaries.
This path is described in
[Envoy docs](https://github.com/envoyproxy/envoy/blob/main/bazel/PPROF.md#cpu-or-memory-consumption-testing-with-gperftools-and-pprof).
It allows you to profile both CPU and memory.