You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+47-1
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ This plugin for the [Cloud Foundry Command Line](https://github.com/cloudfoundry
7
7
Currently, it allows to:
8
8
* Trigger and retrieve a heap dump and a thread dump from an instance of a Cloud Foundry Java application
9
9
* To run jcmd remotely on your application
10
-
* To start, stop and retrieve JFR and async-profiler profiles from your application
10
+
* To start, stop and retrieve JFR and [async-profiler](https://github.com/jvm-profiling-tools/async-profiler) ([SapMachine](https://sapmachine.io) only) profiles from your application
`JAVA_OPTS: '+UnlockDiagnosticVMOptions -XX:+DebugNonSafepoints'` is used to improve
91
+
profiling accurary and has no known negative performance impacts.
92
+
88
93
Please note that this requires the use of an online buildpack (configured in the `buildpack` property). When system buildpacks are used, staging will fail with cache issues, because the system buildpacks don’t have the JDK chached.
89
94
Please also note that this is not to be considered a recommendation to use a full JDK. It's just one option to get the tools required for the use of this plugin when you need it, e.g., for troubleshooting.
90
95
The `version` property is optional and can be used to request a specific Java version.
@@ -102,7 +107,48 @@ If `cf java` is having issues connecting to your app, chances are the problem is
102
107
To verify, run your `cf java` command in "dry-run" mode by adding the `-n` flag and try to execute the command line that `cf java` gives you back.
103
108
If it fails, the issue is not in `cf java`, but in whatever makes `cf ssh` fail.
104
109
110
+
### Examples
111
+
112
+
Getting a heap-dump:
113
+
114
+
```sh
115
+
> cf java heap-dump $APP_NAME
116
+
-> ./$APP_NAME-heapdump-$RANDOM.hprof
117
+
```
118
+
119
+
Getting a thread-dump:
120
+
121
+
```sh
122
+
> cf java thread-dump $APP_NAME
123
+
...
124
+
Full thread dump OpenJDK 64-Bit Server VM ...
125
+
...
126
+
```
127
+
128
+
Creating a CPU-time profile via async-profiler:
129
+
130
+
```sh
131
+
> cf java asprof-start-cpu $APP_NAME
132
+
Profiling started
133
+
# wait some time to gather data
134
+
> cf java asprof-stop-cpu $APP_NAME
135
+
-> ./$APP_NAME-asprof-$RANDOM.jfr
136
+
```
137
+
138
+
Running arbitrary JCMD commands, like `VM.uptime`:
139
+
140
+
```sh
141
+
> cf java jcmd $APP_NAME -a VM.uptime
142
+
Connected to remote JVM
143
+
JVM response code = 0
144
+
$TIME s
145
+
```
146
+
105
147
### Commands
148
+
149
+
The following is a list of all available commands (some of the SapMachine specific),
150
+
generated via `cf java --help`:
151
+
106
152
<pre>
107
153
NAME:
108
154
java - Obtain a heap-dump, thread-dump or profile from a running, SSH-enabled Java application.
0 commit comments