Skip to content

Commit 2eb116d

Browse files
committed
Improve README
1 parent 6b4c3b4 commit 2eb116d

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -248,39 +248,38 @@ The `-k` flag is invalid when invoking non file producing commands.
248248
## Limitations
249249

250250
The capability of creating heap dumps and profiles is also limited by the filesystem available to the container.
251-
The `cf java heap-dump` command triggers the heap dump to file system, read the content of the file over the SSH connection, and then remove the heap dump file from the container's file system (unless you have the `-k` flag set).
251+
The `cf java heap-dump`, `cf java asprof-stop` and `cf java jfr-stop` commands trigger a write to the file system, read the content of the file over the SSH connection, and then remove the file from the container's file system (unless you have the `-k` flag set).
252252
The amount of filesystem space available to a container is set for the entire Cloud Foundry landscape with a global configuration.
253-
The size of a heap dump is roughly linear with the allocated memory of the heap.
254-
So, it could be that, in case of large heaps or the filesystem having too much stuff in it, there is not enough space on the filesystem for creating the heap dump.
255-
In that case, the creation of the heap dump and thus the command will fail.
256-
The same is true for stopping and thereby retrieving
257-
profiles.
253+
The size of a heap dump is roughly linear with the allocated memory of the heap and the size of the profile is related to the length of the recording.
254+
So, it could be that, in case of large heaps, long profiling durations or the filesystem having too much stuff in it, there is not enough space on the filesystem for creating the file.
255+
In that case, the creation of the heap dump or profile recording and thus the command will fail.
258256

259257
From the perspective of integration in workflows and overall shell-friendliness, the `cf java` plugin suffers from some shortcomings in the current `cf-cli` plugin framework:
260258
* There is no distinction between `stdout` and `stderr` output from the underlying `cf ssh` command (see [this issue on the `cf-cli` project](https://github.com/cloudfoundry/cli/issues/1074))
261-
* The `cf java` will however exit with status code `1` when the underpinning `cf ssh` command fails
259+
* The `cf java` will however (mostly) exit with status code `1` when the underpinning `cf ssh` command fails
262260
* If split between `stdout` and `stderr` is needed, you can run the `cf java` plugin in dry-run mode (`--dry-run` flag) and execute its output instead
263-
* The plugin is not current capability of storing output directly to file (see [this issue on the `cf-cli` project](https://github.com/cloudfoundry/cli/issues/1069))
264-
* The upstream change needed to fix this issue has been scheduled at Pivotal; when they provide the new API we need, we'll update the `cf java` command to save output to file.
265261

266262
## Side-effects on the running instance
267263

264+
Storing dumps or profile recordings to the filesystem may lead to to not enough space on the filesystem been available for other tasks (e.g., temp files).
265+
In that case, the application in the container may suffer unexpected errors.
266+
267+
### Thread-Dumps
268268
Executing a thread dump via the `cf java` command does not have much of an overhead on the affected JVM.
269269
(Unless you have **a lot** of threads, that is.)
270270

271+
### Heap-Dumps
271272
Heap dumps, on the other hand, have to be treated with a little more care.
272273
First of all, triggering the heap dump of a JVM makes the latter execute in most cases a full garbage collection, which will cause your JVM to become unresponsive for the duration.
273274
How much time is needed to execute the heap dump, depends on the size of the heap (the bigger, the slower), the algorithm used and, above all, whether your container is swapping memory to disk or not (swap is *bad* for the JVM).
274275
Since Cloud Foundry allows for over-commit in its cells, it is possible that a container would begin swapping when executing a full garbage collection.
275276
(To be fair, it could be swapping even *before* the garbage collection begins, but let's not knit-pick here.)
276277
So, it is theoretically possible that execuing a heap dump on a JVM in poor status of health will make it go even worse.
277278

279+
### Profiles
278280
Profiles might cause overhead depending on the configuration, but the default configurations
279281
typically have a limited overhead.
280282

281-
Secondly, as the JVMs output heap dumps to the filesystem, creating a heap dump may lead to to not enough space on the filesystem been available for other tasks (e.g., temp files).
282-
In that case, the application in the container may suffer unexpected errors.
283-
284283
## Tests and Mocking
285284

286285
The tests are written using [Ginkgo](https://onsi.github.io/ginkgo/) with [Gomega](https://onsi.github.io/gomega/) for the BDD structure, and [Counterfeiter](https://github.com/maxbrunsfeld/counterfeiter) for the mocking generation.

0 commit comments

Comments
 (0)