Skip to content

Added section about async profiler with cf java #1771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

davidhunglam
Copy link
Contributor

Added section about how to use the https://github.com/SAP/cf-cli-java-plugin to run profiling with asprof.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling Mistakes

  • java/operating-applications/optimizing.md:56:8 Unknown word "Asprof"
  • java/operating-applications/optimizing.md:57:34 Unknown word "asprof"

Generally, for each spelling mistake there are 2 ways to fix it:

  1. Fix the spelling mistake and commit it.
  2. The word is incorrectly reported as misspelled → put the word on the project-words.txt list, located in the root project directory.


#### Examples

1. Profile `sample-app-srv` for 30 seconds, write output into a file `profile.jfr` and download the file from the container to the local directory `~/tmp`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what kind of profiling is startet? cpu or alloc or both? I think we should show most important flavours: cpu pofiling and alloc trace. We should at least name the available traces in async profiler (contention, gc, ...)

Copy link
Contributor Author

@davidhunglam davidhunglam Apr 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per default it's cpu profiling. But I've just talked with Johannes a little bit.

In my opinion currently there are too many asprof command variants in cf java and their use cases are not clearly distinguishable: https://github.com/SAP/cf-cli-java-plugin?tab=readme-ov-file#commands.

There's

  • asprof
  • start-asprof
  • stop-asprof
  • asprof-status
  • start-asprof-cpu-profile
  • start-asprof-wall-clock-profile

These are too many variants, and are not very much more useful to begin with, as you can do everything with just cf java asprof.

For example for wall-clock profiling. Instead of

cf java start-asprof-wall-clock-profile app-srv

you could just use

cf java asprof app-srv -a 'start -e wall'

which users that have been working with asprof already would be more familiar with.

Johannes agreed with me and will talk with Andreas Steiner, and they might reduce the command options to just asprof. Then documenting this in Capire will also be easier.

Copy link
Contributor

@BraunMatthias BraunMatthias Apr 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

und wie wäre es mit

cf java asprof app-srv start -cpu 
cf java asprof app-srv start -wall
cf java asprof app-srv start -alloc
cf java asprof app-srv start -lock
cf java asprof app-srv start -a 'start -e wall' // expert mode
cf java asprof app-srv stop -file:<> // file optional
cf java asprof app-srv status

ich finde das intuitiver als die -a Option. Die kann gerne noch als Breakout angeboten sein, aber der 99%-User wird sicher zu den Shortcuts greifen

Choosing an output filename with .html ending indicates to use the output type `flamegraph`, see [FlameGraph visualization](https://github.com/async-profiler/async-profiler/blob/master/docs/GettingStarted.md#flamegraph-visualization)
:::

`.html` files can be opened in a browser, `.jfr` files can be viewed with a viewer such as [OpenJDK Mission Control](https://openjdk.org/projects/jmc/).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can jfr files also be opened in intellij or vscode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In IntelliJ only with the Ultimate Edition. For VSCode I'm not aware of any extension that could open jfr files.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Johannes hat ein PLugin für intellij gebaut - nur das ist eher noch instabil. Du kannst ihn ja fragen, ob wir es schon verlinken sollen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants