---
schema_version: "1"
id: a7eb2bb39ee2a8aaf99b97d43d464052d1cdf7b965db4e2ef9ccd9654d3ffa28
title: Profiling Mule
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/mule-runtime/4.3/profiling-mule.md
canonical_url: https://docs.mulesoft.com/mule-runtime/4.3/profiling-mule
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 36292ba5a50812e56345cbf461e955477262b651c45ddf1513cbb049990559ab
description: MuleSoft Documentation Site
release: "4.3"
latest: false
---
---
product: Mule Runtime
version: 4.3
keywords: anypoint studio, profiling, yourkit, monitoring, performance, memory, cpu, tuning
---

# Profiling Mule

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Profiling Mule runtime engine (Mule) can help you identify memory leaks in your custom Mule
extensions.

To profile Mule, you need to load a Java Profiler into the Mule instance.  
Although there are multiple Java profiler options available, MuleSoft recommends using
[YourKit](https://www.yourkit.com/), a commonly used Java profiler for analyzing JVM performance. If
you’re not using YourKit, visit your respective profiler’s documentation to understand how to
connect to the Mule-Java process.

There are two methods to profile a Mule instance:

## Configure Mule to Point to the YourKit Agent

For this method, you download the YourKit profiler, you configure it in the `wrapper.conf` file, and
then restart your Mule instance. To finalize the process, you connect the YourKit UI to your local
or remote Mule instance.  
Check the YourKit documentation for a detailed explanation on how to properly launch the agent based
on your operating system, and to get a full list of start up parameters.

To use your own YourKit profiler agent, you need to:

1.  [Download](https://www.yourkit.com/java/profiler/download/) the YourKit build to your Mule
    instance. You can download older build versions from the previous Profiler download releases
    page.

2.  Expand the YourKit package content and find the agent inside the `/bin/` folder.

3.  Enable the YourKit agent to interact with your Mule instance by adding the following line to the
    `wrapper.conf` file located in the `$MULE_HOME/conf` path:

wrapper.java.additional.<n>=-agentpath:<absolute-path-to-the-agent>=delay=10000

The values of these fields are as follows:

- `<absolute-path-to-the-agent>` value varies depending on the configuration and operating system of
  your machine.

- `<n>` this component of the Java Service Wrapper needs to be in sequence with the rest of the
  `wrapper.java.additional` components in your `wrapper.conf` file.

- `<port>` is an optional port specification. By default, YourKit agent scans for an internet facing
  port.

Assuming you downloaded `yjp-2013-build-13062` for Linux, for example, the entry to add in the
`wrapper.conf` should look like this:

wrapper.java.additional.<n>=-agentpath:/yjp-2013-build-13062/bin/linux-x86-64/libyjpagent.so=delay=10000,port=<port>

4.  Restart Mule.

5.  After Mule restarts, you set the YourKit profiler UI to connect to your local or remote Mule
    instance.

### Connect the YourKit UI to a Local Mule Instance

1.  Launch YourKit on your local machine.

2.  In Monitor Local Applications, double-click the `MuleContainerBootstrap` process:

    ![profiling mule 286a5](/mulesoft/current/en-us/mule-runtime/4.3/_images/profiling-mule-286a5.png)

3.  Confirm that YourKit is connected to your Mule instance:

    ![yourkit hooked up](/mulesoft/current/en-us/mule-runtime/4.3/_images/yourkit-hooked-up.png)

### Connect the YourKit UI to a Remote Mule Instance

1.  Launch YourKit on your local machine.

2.  In Monitor Remote Applications, click **Connect to remote application**.

    ![monitor remote apps](/mulesoft/current/en-us/mule-runtime/4.3/_images/monitor-remote-apps.png)

3.  Set up your server username and password.

4.  Configure the SSH authentication:

    ![yourkit auth](/mulesoft/current/en-us/mule-runtime/4.3/_images/yourkit-auth.png)

5.  Click **OK**.

6.  After scanning for available applications, YourKit should be hooked up to your Mule instance.

    ![yourkit hooked up](/mulesoft/current/en-us/mule-runtime/4.3/_images/yourkit-hooked-up.png)

## Running the Profiler Agent in Attach Mode

For this method, you download the YourKit profiler and configure its agent to run in attach mode. To
finalize the process you run the profiler. Running in attach mode enables you to profile a running
Mule instance without restarting it.

The steps for this task vary depending on your environment. Refer to YourKit documentation if the
examples here are not appropriate.

1.  [Download](https://www.yourkit.com/java/profiler/download/) the profiler to your Mule instance.

2.  Unpackage the profiler.

3.  Determine the PID of Mule by running `jps`.

    ```console
    jps
    ```

4.  Capture the PID of the `MuleContainerBootstrap`.

    2838 MuleContainerBootstrap 21311 Jps

5.  Within the YourKit package, open the `bin` directory.

    ```console
    cd yjp-2015-build-15086/bin
    ```

6.  Run `yph.sh`, including the `-attach` flag with the PID of `MuleContainerBootstrap`:

    ```console
    ./yph.sh -attach 2838
    ```

7.  Verify the agent is attached

    ```console
    Attaching to process 2838 using default options
    The profiler agent has attached. Waiting while it initializes...
    The agent is loaded and is listening on port 10001.
    You can connect to it from the profiler UI.
    ```

## See Also

[YourKit](https://www.yourkit.com/)
