
> ## Documentation Index
> Fetch the complete documentation index at: https://docs.medusajs.com/llms.txt
> Use this file to discover all available pages before exploring further.
  
<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.medusajs.com/cloud/agents/feedback

```json
{
  "agent": "Name of the agent",
  "path": "/optimize/feedback", # the path of the page where the issue is observed
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Server Monitoring

In this guide, you'll learn how to monitor your environment's server performance in Cloud.

The Servers monitoring page covers the CPU and memory usage of your environment's server instances, as well as their restart patterns. To monitor background job performance, check the [Workers monitoring page](https://docs.medusajs.com/monitoring/workers).

## Server Metrics Overview

The Servers monitoring page provides real-time insights into your servers' performance.

By monitoring these metrics, you can ensure that your environment is running smoothly, identify potential performance bottlenecks, and troubleshoot issues effectively.

You can monitor key metrics such as:

- **CPU Usage**: Track how much of your allocated CPU resources are being used.
- **Memory Usage**: Monitor memory consumption patterns across your server instances.
- **Restarts**: Keep an eye on server restart frequency and patterns.

***

## Troubleshooting Common Server Issues

The following table outlines common server performance issues, their potential causes, and the specific metrics you can monitor to identify and troubleshoot these issues effectively.

|Issue|Potential Cause|Metric to Check|
|---|---|---|
|Slow response times|CPU usage consistently near or exceeding allocation due to inefficient code.|Total CPU|
|Application crashes or unexpected behavior|Insufficient memory allocation or memory leaks in your application code.|Summary of Memory Usage Across Servers|
|Frequent server restarts|Crashes caused by unhandled exceptions or out-of-memory conditions.|Server Restarts|
|Uneven load distribution across instances|Specific server instances handling disproportionately more traffic than others.|Summary of CPU Usage Across Servers|
|High |Excessive CPU or memory consumption in server instances due to inefficient code.|Total CPU|

***

## View Server Metrics

To view your project environment's server performance:

1. In the [environment's dashboard](https://docs.medusajs.com/environments/long-lived#open-environment-dashboard), click on the "Monitoring" tab.
2. Select "Servers" from the sidebar.

This opens the Servers monitoring dashboard, where you can analyze your environment's server performance across any time range.

### Change Time Range

By default, the dashboard shows metrics for the last hour. To change the time range:

1. Click on the time range selector at the top right of the dashboard.
2. Either choose a preset time range (for example, last 24 hours) or set a custom time range.

The charts will update to show metrics for the selected time range, allowing you to analyze performance trends and patterns over different periods.

### Refresh Metrics

To refresh the metrics displayed on the dashboard, click the <InlineIcon Icon={ArrowPath} alt="refresh" /> button.

The metrics will refresh to show the most up-to-date performance data for your environment's servers in the selected time range.

***

## Monitor Total CPU

The Total CPU usage of your environment shows combined CPU allocation and usage across all server replicas of your environment. It's useful to understand your overall CPU resource consumption and identify trends or spikes in usage.

In the [Servers monitoring dashboard](#view-server-metrics), the Total CPU chart shows:

- **Allocated CPU** (blue): The total CPU resources allocated to your servers.
- **Used CPU** (green): The actual CPU resources being consumed by your application.

If your environment is slow or unresponsive, check if the Used CPU is consistently close to or exceeding the Allocated CPU, which may indicate the need for performance improvements in your application.

***

## Monitor Summary of CPU Usage Across Servers

The Summary of CPU usage across servers of your environment shows CPU usage patterns across individual server instances.

In the [Servers monitoring dashboard](#view-server-metrics), the Per-Server CPU chart shows:

- **Minimum CPU**: The lowest CPU percentage used by a server instance at a given time.
- **Maximum CPU**: The highest CPU percentage used by a server instance at a given time.
- **Average CPU**: The mean CPU usage across all server instances at a given time.

This breakdown helps you identify peaks in CPU usage across your server instances and determine if specific instances are under heavy load or if CPU usage is evenly distributed across your infrastructure.

***

## Monitor Summary of Memory Usage Across Servers

The Summary of Memory usage across servers of your environment shows memory consumption patterns across individual server instances.

In the [Servers monitoring dashboard](#view-server-metrics), the Summary of Memory chart shows:

- **Minimum Memory**: The lowest memory percentage used across instances at a given time.
- **Maximum Memory**: The highest memory percentage used across instances at a given time.
- **Average Memory**: The mean memory usage across all instances at a given time.

This breakdown helps you identify if specific server instances are consuming excessive memory or if memory usage is consistent across your infrastructure.

***

## Monitor Server Restarts

The Server Restarts section helps you track the frequency and patterns of unexpected server restarts in your environment. Frequent or unexpected restarts can indicate underlying issues with your application, such as crashes and memory leaks.

In the [Servers monitoring dashboard](#view-server-metrics), the Server Restarts chart shows the number of restarts across your server instances over time.

You can also correlate restart patterns with CPU and memory usage to identify potential causes of instability in your environment.


---

The best way to deploy Medusa is through Medusa Cloud where you get autoscaling production infrastructure fine tuned for Medusa. Create an account by signing up at cloud.medusajs.com/signup.
