Skip to content

Commit c8202bf

Browse files
authored
Merge branch 'master' into heap-dump-compress-redact
2 parents 7f9847b + 13055ac commit c8202bf

1 file changed

Lines changed: 68 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,74 @@ cf install-plugin https://github.com/SAP/cf-cli-java-plugin/releases/download/sn
7272
cf install-plugin https://github.com/SAP/cf-cli-java-plugin/releases/download/snapshot/cf-cli-java-plugin-linux-arm64
7373
```
7474

75+
## Common Tasks
76+
77+
### My CF app is not responding — find what it is stuck on
78+
79+
Run `jstall` first — it detects deadlocks, identifies BLOCKED threads, and shows what
80+
each thread is waiting for:
81+
82+
```bash
83+
cf java jstall $APP_NAME
84+
```
85+
86+
If there is a deadlock, it will be listed at the top with the cycle of threads and monitors.
87+
For a focused deadlock check only:
88+
89+
```bash
90+
cf java jstall $APP_NAME --args 'deadlock all'
91+
```
92+
93+
If no deadlock, look for threads in `BLOCKED` state and the monitor they are waiting on.
94+
The thread that *holds* that monitor is the bottleneck. For a plain thread dump:
95+
96+
```bash
97+
cf java thread-dump $APP_NAME
98+
```
99+
100+
### My CF app is using too much CPU
101+
102+
`most-work` takes repeated thread dumps and ranks threads by on-CPU frequency —
103+
no async-profiler needed:
104+
105+
```bash
106+
cf java jstall $APP_NAME --args 'most-work --dumps 5 all'
107+
```
108+
109+
For a proper CPU flame graph (slower, but much more detail):
110+
111+
```bash
112+
cf java jstall $APP_NAME --args 'flame all'
113+
# Downloads an HTML flamegraph to your current directory
114+
```
115+
116+
Or use the two-step async-profiler approach to capture a specific window:
117+
118+
```bash
119+
cf java asprof-start-cpu $APP_NAME
120+
# reproduce the slow operation or wait 30–60 s
121+
cf java asprof-stop $APP_NAME
122+
# Downloads $APP_NAME-asprof-<random>.jfr — open in JDK Mission Control
123+
```
124+
125+
### My CF app crashed with OutOfMemoryError — take a heap dump
126+
127+
Take a heap dump from the running (or restarted) instance and download it:
128+
129+
```bash
130+
cf java heap-dump $APP_NAME
131+
# Downloads $APP_NAME-heapdump-<random>.hprof to current directory
132+
```
133+
134+
Analyse with [hprof-analyzer](https://github.com/parttimenerd/hprof-analyzer) for Leak Suspects and Top Consumers:
135+
136+
```bash
137+
hprof-analyzer $APP_NAME-heapdump-*.hprof report.html
138+
# Open report.html → "Leak Suspects" and "Top Consumers" tabs
139+
```
140+
141+
**Note:** requires jmap — see [Prerequisites](#prerequisites) if you see a "jmap not found" error.
142+
75143
## Usage
76144

77145
### Prerequisites

0 commit comments

Comments
 (0)