Skip to content

Commit c964b19

Browse files
michele-mancioppiTimGerlach
authored andcommitted
Update README.md (#3)
1 parent 8221036 commit c964b19

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

README.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
This plugin for the [Cloud Foundry Command Line](https://github.com/cloudfoundry/cli) provides convenience utilities to work with Java applications deployed on Cloud Foundry.
44

55
Currently, it allows to:
6-
* Trigger and retrieve a heap-dump from an instance of a Cloud Foundry Java application
7-
* Trigger and retrieve a thread-dump from an instance of a Cloud Foundry Java application
6+
* Trigger and retrieve a heap dump from an instance of a Cloud Foundry Java application
7+
* Trigger and retrieve a thread dump from an instance of a Cloud Foundry Java application
88

99
## Installation
1010

@@ -25,7 +25,7 @@ On Windows, the plugin will refuse to install unless the binary has the `.exe` f
2525

2626
<pre>
2727
NAME:
28-
java - Obtain a heap-dump or thread-dump from a running, Diego-enabled, SSH-enabled Java application
28+
java - Obtain a heap dump or thread dump from a running, Diego-enabled, SSH-enabled Java application
2929

3030
USAGE:
3131
cf java [heap-dump|thread-dump] APP_NAME
@@ -36,12 +36,12 @@ OPTIONS:
3636
-keep -k, keep the heap dump in the container; by default the heap dump will be deleted from the container's filesystem after been downloaded
3737
</pre>
3838

39-
The heap-dump or thread-dump (depending on what you execute) will be outputted to `std-out`.
39+
The heap dump or thread dump (depending on what you execute) will be outputted to `std-out`.
4040
You may want to redirect the command's output to file, e.g., by executing:
4141
`cf java heap-dump [my_app] -i [my_instance_index] > heap-dump.hprof`
4242

4343
The `-k` flag is invalid when invoking `cf java thread-dump`.
44-
(Unlike with heap-dumps, the JVM does not need to output the threaddump to file before streaming it out.)
44+
(Unlike with heap dumps, the JVM does not need to output the threaddump to file before streaming it out.)
4545

4646
## Limitations
4747

@@ -53,6 +53,13 @@ If `cf java` is having issues connecting to your app, chances are the problem is
5353
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.
5454
If it fails, the issue is not in `cf java`, but in whatever makes `cf ssh` fail.
5555

56+
The capability of creating heap dumps is also limited by the filesystem available to the container.
57+
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).
58+
The amount of filesystem space available to a container is set for the entire Cloud Foundry landscape with a global configuration.
59+
The size of a heap dump is roughly linear with the allocated memory of the heap.
60+
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.
61+
In that case, the creation of the heap dump and thus the command will fail.
62+
5663
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:
5764
* 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))
5865
* The `cf java` will however exit with status code `1` when the underpinning `cf ssh` command fails
@@ -62,26 +69,22 @@ From the perspective of integration in workflows and overall shell-friendliness,
6269

6370
## Side-effects on the running instance
6471

65-
Executing a thread-dump via the `cf java` command does not have much of an overhead on the affected JVM.
72+
Executing a thread dump via the `cf java` command does not have much of an overhead on the affected JVM.
6673
(Unless you have **a lot** of threads, that is.)
6774

68-
Heap-dumps, on the other hand, have to be treated with a little more care.
69-
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.
70-
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).
75+
Heap dumps, on the other hand, have to be treated with a little more care.
76+
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.
77+
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).
7178
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.
7279
(To be fair, it could be swapping even *before* the garbage collection begins, but let's not knit-pick here.)
7380
So, it is theoretically possible that execuing a heap dump on a JVM in poor status of health will make it go even worse.
7481

75-
Secondly, JVMs output heap dumps to the filesystem.
76-
What the `cf java heap-dump` command does it, quite literally, trigger 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).
77-
The amount of filesystem space available to a container is set for the entire Cloud Foundry landscape with a global configuration.
78-
The size of a heap dump is linear with the size of the heap.
79-
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.
80-
In that case, the command will likely fail in a rather unpredictable fashion.
82+
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).
83+
In that case, the application in the container may suffer unexpected errors.
8184

8285
## Tests and Mocking
8386

84-
The tests are written using [Ginkgo](https://onsi.github.io/ginkgo/) and [Gomega](https://onsi.github.io/gomega/) for the BDD structure, and [Counterfeit](https://github.com/maxbrunsfeld/counterfeiter) for the mocking generation.
85-
Unless modifications are needed to the helper interfaces `cmd.CommandExecutor` and `uuid.UUIDGenerator` are needed, there should be no need to regenerate the mocks.
87+
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.
88+
Unless modifications to the helper interfaces `cmd.CommandExecutor` and `uuid.UUIDGenerator` are needed, there should be no need to regenerate the mocks.
8689

87-
To run the tests, go to the root of the repository and simply run `gingko` (you may need to install the package, e.g., `sudo apt install golang-ginkgo-dev` on Ubuntu).
90+
To run the tests, go to the root of the repository and simply run `gingko` (you may need to install Ginkgo first, e.g., `go get github.com/onsi/ginkgo/ginkgo` puts the executable under `$GOPATH/bin`).

0 commit comments

Comments
 (0)