Skip to content

Commit

Permalink
feat: upgrade to async profiler 2
Browse files Browse the repository at this point in the history
  • Loading branch information
loicmathieu committed Oct 19, 2021
1 parent 23ea75f commit 30a7c65
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ In order to profile a Java application in pod `mypod` for 1 minute and save the
```shell
kubectl flame mypod -t 1m --lang java -f /tmp/flamegraph.svg
```
Note that Java is using async-profiler 2 that also supports HTML flamegraph by switching the file extension to `.html`.

### Profiling Alpine based container
Profiling Java application in alpine based containers require using `--alpine` flag:
```shell
Expand Down
8 changes: 3 additions & 5 deletions agent/docker/jvm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ RUN go get -d -v ./...
RUN cd agent && go build -o /go/bin/agent

FROM openjdk:8 as asyncprofiler
RUN echo deb http://deb.debian.org/debian stretch-backports main > /etc/apt/sources.list.d/stretch-backports.list && \
apt-get update && \
apt-get -y install build-essential
RUN git clone https://github.com/edeNFed/async-profiler.git
RUN cd async-profiler && make
RUN curl -o async-profiler-2.5-linux-x64.tar.gz -L \
https://github.com/jvm-profiling-tools/async-profiler/releases/download/v2.5/async-profiler-2.5-linux-x64.tar.gz
RUN tar -xvf async-profiler-2.5-linux-x64.tar.gz && mv async-profiler-2.5-linux-x64 async-profiler

FROM bitnami/minideb:stretch
RUN mkdir -p /app/async-profiler/build
Expand Down
7 changes: 4 additions & 3 deletions agent/docker/jvm/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ RUN go get -d -v ./...
RUN cd agent && go build -o /go/bin/agent

FROM openjdk:8-alpine as asyncprofiler
RUN apk add build-base git linux-headers
RUN git clone https://github.com/edeNFed/async-profiler.git
RUN cd async-profiler && make
RUN apk add build-base linux-headers curl
RUN curl -o async-profiler-2.5-linux-musl-x64.tar.gz -L \
https://github.com/jvm-profiling-tools/async-profiler/releases/download/v2.5/async-profiler-2.5-linux-musl-x64.tar.gz
RUN tar -xvf async-profiler-2.5-linux-musl-x64.tar.gz && mv async-profiler-2.5-linux-musl-x64 async-profiler

FROM alpine
RUN mkdir -p /app/async-profiler/build
Expand Down
2 changes: 1 addition & 1 deletion agent/profiler/jvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

const (
profilerDir = "/tmp/async-profiler"
fileName = "/tmp/flamegraph.svg"
fileName = "/tmp/flamegraph.html"
profilerSh = profilerDir + "/profiler.sh"
)

Expand Down

0 comments on commit 30a7c65

Please sign in to comment.