diff --git a/docs/30-development/profiling-an-application-running-on-sapmachine-with-async-profiler.md b/docs/30-development/profiling-an-application-running-on-sapmachine-with-async-profiler.md new file mode 100644 index 00000000..90f22ed4 --- /dev/null +++ b/docs/30-development/profiling-an-application-running-on-sapmachine-with-async-profiler.md @@ -0,0 +1,101 @@ + +# Profiling an Application Running on SapMachine with async-profiler + +You can use async-profiler \([asprof](https://github.com/async-profiler/async-profiler/blob/master/README.md)\) to profile your Java application on SapMachine. + + + + +## Prerequisites + +- You have to run your application on SapMachine 17.0.14 or 21.0.6, which is part of the SAP Java Buildpack 1.110.0 and 2.24.0. + +- You have installed the Cloud Foundry command line interface. See: [Download and Install the cf CLI](https://help.sap.com/docs/btp/sap-business-technology-platform/download-and-install-cloud-foundry-command-line-interface?version=Cloud) + +- You have installed the Cloud Foundry Java plugin for the Cloud Foundry command line interface. See: [Download and Install the cf Java plugin](https://help.sap.com/docs/btp/sap-business-technology-platform/cf-cli-plug-ins?&version=Cloud). + +- You are logged on to a SAP BTP, Cloud Foundry space. See: [Log On to the Cloud Foundry Environment Using cf CLI](https://help.sap.com/docs/btp/sap-business-technology-platform/log-on-to-cloud-foundry-environment-using-cloud-foundry-command-line-interface?version=Cloud) + +- You have a Java application that is up and running on SAP BTP, Cloud Foundry. + +- You have enabled SSH for your application. See: [Configuring SSH access at the app level](https://docs.cloudfoundry.org/devguide/deploy-apps/ssh-apps.html#configure-ssh-access-apps) + + + + + +## Context + +To profile with async-profiler, you can use the Cloud Foundry Java plugin. It provides some convenience commands for profiling. To do that, follow the steps below. + +> ### Note: +> In the steps below, we use **myapp** as *exemplary* application name. Replace them with your actual app name. + + + + +## Procedure + +1. Start CPU profiling. Execute: + + ``` + cf java start-asprof-cpu-profile myapp + ``` + + **Result**: + + ``` + + Profiling started + + ``` + +2. \(Optional\) You can check the status of the profiling. Execute: + + ``` + cf java asprof-status myapp + ``` + + **Result**: + + ``` + + Profiling is running for xx seconds + + ``` + +3. Stop profiling and download the profiling data to the given local-dir. Execute: + + ``` + cf java stop-asprof -local-dir . myapp + ``` + + **Result**: + + ``` + + --- Execution profile --- + Total samples : 15 + ... + + Successfully created JFR recording in application container at: /tmp/myapp-.jfr + Jfr recording file saved to: ./myapp-asprof-.jfr + Jfr recording file deleted in app container + + ``` + + +4. Check with cf java the additional convenience commands. To profile other events you can start async-profiler by executing the start-asprof with arguments. Execute: + + ``` + cf java start-asprof --args "-e nativemem" myapp + ``` + + +**Related Information** + + +[Profiling modes](https://github.com/async-profiler/async-profiler/blob/master/docs/ProfilingModes.md) + +[Profiler options](https://github.com/async-profiler/async-profiler/blob/master/docs/ProfilerOptions.md) + diff --git a/docs/30-development/profiling-java-applications-bc7052d.md b/docs/30-development/profiling-java-applications-bc7052d.md index f0ca7624..902d9319 100644 --- a/docs/30-development/profiling-java-applications-bc7052d.md +++ b/docs/30-development/profiling-java-applications-bc7052d.md @@ -9,5 +9,6 @@ Application profiling helps you analyze the resource consumption of your Java ap [Profiling an Application Running on SAP JVM](profiling-an-application-running-on-sap-jvm-e709773.md "The SAP JVM Profiler is a tool that helps you analyze the resource consumption of a Java application running on SAP Java Virtual Machine (JVM). You can use it to profile simple standalone Java programs or complex enterprise applications.") -[Profiling an Application Running on SapMachine](profiling-an-application-running-on-sapmachine-864e352.md "You can use Java Flight Recorder (JFR) to profile your Java application on SapMachine, and Java Mission Control (JMC) to do remote profiling and analysis.") +[Profiling an Application Running on SapMachine with JFR/JMC](profiling-an-application-running-on-sapmachine-864e352.md "You can use Java Flight Recorder (JFR) to profile your Java application on SapMachine, and Java Mission Control (JMC) to do remote profiling and analysis.") +[Profiling an Application Running on SapMachine with async-profiler](profiling-an-application-running-on-sapmachine-async-profiler.md "You can use asprof to profile your Java application on SapMachine.") diff --git a/docs/50-administration-and-ops/cf-cli-plug-ins-dc28ce3.md b/docs/50-administration-and-ops/cf-cli-plug-ins-dc28ce3.md index e52a1fbe..f1c72697 100644 --- a/docs/50-administration-and-ops/cf-cli-plug-ins-dc28ce3.md +++ b/docs/50-administration-and-ops/cf-cli-plug-ins-dc28ce3.md @@ -8,3 +8,4 @@ A list of additional commands that have been implemented as plug-ins to extend t [Multitarget Application Commands for the Cloud Foundry Environment](multitarget-application-commands-for-the-cloud-foundry-environment-65ddb1b.md) +[Java Commands for the Cloud Foundry Environment](java-plug-in-for-the-cloud-foundry-command-line-interface.md) diff --git a/docs/50-administration-and-ops/install-the-java-cli-plugin-in-the-cloud-foundry-environment.md b/docs/50-administration-and-ops/install-the-java-cli-plugin-in-the-cloud-foundry-environment.md new file mode 100644 index 00000000..a7f76bec --- /dev/null +++ b/docs/50-administration-and-ops/install-the-java-cli-plugin-in-the-cloud-foundry-environment.md @@ -0,0 +1,52 @@ + +# Install the Java CLI Plugin in the Cloud Foundry Environment + +The Java plugin provides convenience utilities to work with Java applications deployed on Cloud Foundry. + + + + +## Prerequisites + +You have installed the Cloud Foundry command line interface. See [Download and Install the Cloud Foundry Command Line Interface](download-and-install-the-cloud-foundry-command-line-interface-4ef907a.md). + + + + +## Procedure + +1. Open the command line interface or terminal. + +2. Check if a previous version is installed by using the command `cf plugins`. If the `java` is already installed, you have to uninstall it using the command `cf uninstall-plugin java`. + +3. To install the latest available version of the plugin, proceed as follows: + + a. Make sure that you have the Cloud Foundry community repository in your Cloud Foundry command line interface. If it is not available there, add it by executing the following command: + + cf add-plugin-repo CF-Community https://plugins.cloudfoundry.org + + b. To install the plugin, enter the following command: + + cf install-plugin -r CF_Community java + + + > ### Note: + > Manual Installation if latest version is not available in the Cloud Foundry community repository + > + > a. Download the binary file for your target OS from the [latest release](https://github.com/SAP/cf-cli-java-plugin/releases/latest). + > + > b. If you've already installed the plugin and are updating it, you must first execute the cf uninstall-plugin java command. + > + > c. Install the plugin with cf install-plugin [cf-cli-java-plugin] (replace [cf-cli-java-plugin] with the actual binary name you will use, which depends on the OS you are running). + +4. Verify that the plugin has been installed successfully by entering `cf plugins`. + + You see a list of plugins that now includes the java CLI Plugin for the Cloud Foundry command line interface. The output also displays commands that are specific to this plugin. + + +**Related Information** + + +[Download and Install the Cloud Foundry Command Line Interface](download-and-install-the-cloud-foundry-command-line-interface-4ef907a.md "Download and set up the Cloud Foundry Command Line Interface (cf CLI) to start working with the Cloud Foundry environment.") + + diff --git a/docs/50-administration-and-ops/java-plug-in-for-the-cloud-foundry-command-line-interface.md b/docs/50-administration-and-ops/java-plug-in-for-the-cloud-foundry-command-line-interface.md new file mode 100644 index 00000000..8505bca2 --- /dev/null +++ b/docs/50-administration-and-ops/java-plug-in-for-the-cloud-foundry-command-line-interface.md @@ -0,0 +1,13 @@ + + +# Java Plug-In for the Cloud Foundry Command Line Interface + +Use the Java plug-in for the Cloud Foundry command line interface to get heap-dumps, thread-dumps and profiling data (JFR or async-profiler). + +Before using the extended commands in the Cloud Foundry environment, you need to install the Java plug-in in the Cloud Foundry environment as described in. [Install the Java CLI Plugin in the Cloud Foundry Environment.](https://help.sap.com/docs/btp/sap-business-technology-platform/install-multiapps-cli-plugin-in-cloud-foundry-environment?version=Cloud) + +**Related Information** + + +[Profiling Java Applications in the Cloud Foundry Environment](../30-development/profiling-an-application-running-on-sapmachine-with-async-profiler.md "Profiling Java Applications in the Cloud Foundry Environment.") +