---
schema_version: "1"
id: 5e1f20c19d1a155c884f34bdbe9f6b8e0cc52fb51c1d06f6328cf3e2e6850372
title: Application Monitoring and Automatic Restarts
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/cloudhub/worker-monitoring.md
canonical_url: https://docs.mulesoft.com/cloudhub/worker-monitoring
source_site: docs.mulesoft.com
content_type: documentation
content_hash: e3e6807c76229dc913a6fd23cbf30836cccbac314e313752c66ee83a836c923c
description: MuleSoft Documentation Site
latest: true
---
---
product: CloudHub
---

# Application Monitoring and Automatic Restarts

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

CloudHub monitors all applications and enables you to receive notifications and diagnostic
information if your application becomes unresponsive.

You can enable automatic restarts so that your application can recover automatically without your
intervention.

## How Application Monitoring Works

CloudHub uses the Mule Agent health check endpoint to determine the readiness of a deployment. This
monitoring method provides a thorough check to ensure that the application is deployed and applies
gateway policies.

Every 30 seconds, CloudHub checks the health check endpoint. If CloudHub detects that the health
check endpoint fails three times in a row, the logs print a warning.

CloudHub triggers a notification to the console to alert you that a worker for an application
stopped responding.

If you configure email alerts, the unresponsive worker also triggers an email alert based on the
`Worker Not Responding` event.

## Enable Automatic Restarts

You can enable automatic restarts when you deploy a new application or redeploy an existing
application.

- Deploy a new app

  1.  In Runtime Manager, click **Applications** in the menu on the left.

  2.  Click **Deploy Application** and select **CloudHub** from **Deployment Target**.

  3.  Select the **Automatically restart application when not responding** option:

      ![Automatically restart application when not responding option](/mulesoft/current/en-us/cloudhub/_images/cloudhub-app-autorestart.png)

      Figure 1. The arrow shows the **Automatically restart application when not responding**
      option.

  4.  Click **Deploy Application**.

- Redeploy an existing app

  1.  In Runtime Manager, click **Applications** in the menu on the left.

  2.  Click the app status to display the details pane on the right

  3.  Click the **Manage Application** button to display the **Settings** page for the app.

  4.  Select the **Automatically restart application when not responding** option:

      ![Automatically restart application when not responding option](/mulesoft/current/en-us/cloudhub/_images/cloudhub-app-autorestart.png)

      Figure 2. The arrow shows the **Automatically restart application when not responding**
      option.

  5.  Click **Apply Changes**.

> [!NOTE] If you change the flag `monitoringEnabled` via API, the application doesn’t restart
> automatically and you must restart it manually.

## How Automatic Restarts and Relaunches Work

If you select the **Automatically restart application when not responding** option, CloudHub
monitors the worker and automatically attempts recovery using two mechanisms: application restarts
and application relaunches.

### Application Restarts

CloudHub continuously checks the health of the worker JVM. If the JVM becomes unresponsive, CloudHub
restarts the application on the same worker instance.

- If the restart succeeds, health monitoring continues.

- If the restart fails, CloudHub attempts up to five restarts.

After five restart attempts, CloudHub stops trying to restart the application on that worker.

### Application Relaunches

After CloudHub exhausts all restart attempts, it evaluates the worker state and attempts an
application relaunch. During an application relaunch, CloudHub terminates the failed worker and
provisions a new worker instance.

CloudHub attempts up to three application relaunches.

If all relaunch attempts fail:

- CloudHub stops automatic recovery.

- CloudHub sends you a notification.

- You must manually redeploy the application to restore it.

The logs show the details of the restart and relaunch procedures.

### Without Automatic Restarts

If you don’t select the **Automatically restart application when not responding** option, CloudHub
displays a notification and a log message when the application becomes unresponsive, but doesn’t
attempt automatic recovery. You must manually restart the application.

## See Also

- [Configure Alerts](https://docs.mulesoft.com/runtime-manager/alerts-on-runtime-manager)

- [Deploy to CloudHub](https://docs.mulesoft.com/cloudhub/deploying-to-cloudhub)

- [Manage Deployed Applications](https://docs.mulesoft.com/runtime-manager/managing-deployed-applications)

- [Manage Applications on CloudHub](https://docs.mulesoft.com/cloudhub/managing-applications-on-cloudhub)

- [Monitor Applications and Servers](https://docs.mulesoft.com/runtime-manager/monitoring)
