Raw
1 import { InlineIcon, Note, Table } from "docs-ui"
2 import { ArrowPath } from "@medusajs/icons"
3
4 export const metadata = {
5 title: `Server Monitoring`,
6 }
7
8 # {metadata.title}
9
10 In this guide, you'll learn how to monitor your environment's server performance in Cloud.
11
12 <Note>
13
14 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](../workers/page.mdx).
15
16 </Note>
17
18 ## Server Metrics Overview
19
20 The Servers monitoring page provides real-time insights into your servers' performance.
21
22 By monitoring these metrics, you can ensure that your environment is running smoothly, identify potential performance bottlenecks, and troubleshoot issues effectively.
23
24 You can monitor key metrics such as:
25
26 - **CPU Usage**: Track how much of your allocated CPU resources are being used.
27 - **Memory Usage**: Monitor memory consumption patterns across your server instances.
28 - **Restarts**: Keep an eye on server restart frequency and patterns.
29
30 ---
31
32 ## Troubleshooting Common Server Issues
33
34 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.
35
36 <Table>
37 <Table.Header>
38 <Table.Row>
39 <Table.HeaderCell>
40 Issue
41 </Table.HeaderCell>
42 <Table.HeaderCell>
43 Potential Cause
44 </Table.HeaderCell>
45 <Table.HeaderCell>
46 Metric to Check
47 </Table.HeaderCell>
48 </Table.Row>
49 </Table.Header>
50 <Table.Body>
51 <Table.Row>
52 <Table.Cell>
53 Slow response times
54 </Table.Cell>
55 <Table.Cell>
56 CPU usage consistently near or exceeding allocation due to inefficient code.
57 </Table.Cell>
58 <Table.Cell>
59 [Total CPU](#monitor-total-cpu) and [Summary of CPU Usage Across Servers](#monitor-summary-of-cpu-usage-across-servers)
60 </Table.Cell>
61 </Table.Row>
62 <Table.Row>
63 <Table.Cell>
64 Application crashes or unexpected behavior
65 </Table.Cell>
66 <Table.Cell>
67 Insufficient memory allocation or memory leaks in your application code.
68 </Table.Cell>
69 <Table.Cell>
70 [Summary of Memory Usage Across Servers](#monitor-summary-of-memory-usage-across-servers)
71 </Table.Cell>
72 </Table.Row>
73 <Table.Row>
74 <Table.Cell>
75 Frequent server restarts
76 </Table.Cell>
77 <Table.Cell>
78 Crashes caused by unhandled exceptions or out-of-memory conditions.
79 </Table.Cell>
80 <Table.Cell>
81 [Server Restarts](#monitor-server-restarts) and [Summary of Memory Usage Across Servers](#monitor-summary-of-memory-usage-across-servers)
82 </Table.Cell>
83 </Table.Row>
84 <Table.Row>
85 <Table.Cell>
86 Uneven load distribution across instances
87 </Table.Cell>
88 <Table.Cell>
89 Specific server instances handling disproportionately more traffic than others.
90 </Table.Cell>
91 <Table.Cell>
92 [Summary of CPU Usage Across Servers](#monitor-summary-of-cpu-usage-across-servers) and [Summary of Memory Usage Across Servers](#monitor-summary-of-memory-usage-across-servers)
93 </Table.Cell>
94 </Table.Row>
95 <Table.Row>
96 <Table.Cell>
97 High [Flex Usage](../../usage/page.mdx#what-is-flex-usage)
98 </Table.Cell>
99 <Table.Cell>
100 Excessive CPU or memory consumption in server instances due to inefficient code.
101 </Table.Cell>
102 <Table.Cell>
103 [Total CPU](#monitor-total-cpu) and [Summary of Memory Usage Across Servers](#monitor-summary-of-memory-usage-across-servers)
104 </Table.Cell>
105 </Table.Row>
106 </Table.Body>
107 </Table>
108
109 <Note>
110
111 If the metrics don't show a cause related to your application, [check the Cloud status page](../../status/page.mdx) for ongoing Cloud incidents that may be affecting your environment.
112
113 </Note>
114
115 ---
116
117 ## View Server Metrics
118
119 To view your project environment's server performance:
120
121 1. Go to the [environment's dashboard](../../environments/long-lived/page.mdx#open-environment-dashboard).
122 2. Click **Monitoring** > **Servers** in the sidebar.
123
124 This opens the Servers monitoring dashboard, where you can analyze your environment's server performance across any time range.
125
126 ### Change Time Range
127
128 By default, the dashboard shows metrics for the last hour. To change the time range:
129
130 1. Click on the time range selector at the top right of the dashboard.
131 2. Either choose a preset time range (for example, last 24 hours) or set a custom time range.
132
133 The charts will update to show metrics for the selected time range, allowing you to analyze performance trends and patterns over different periods.
134
135 ### Refresh Metrics
136
137 To refresh the metrics displayed on the dashboard, click the <InlineIcon Icon={ArrowPath} alt="refresh" /> button.
138
139 The metrics will refresh to show the most up-to-date performance data for your environment's servers in the selected time range.
140
141 ---
142
143 ## Monitor Total CPU
144
145 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.
146
147 In the [Servers monitoring dashboard](#view-server-metrics), the Total CPU chart shows:
148
149 - **Allocated CPU** (blue): The total CPU resources allocated to your servers.
150 - **Used CPU** (green): The actual CPU resources being consumed by your application.
151
152 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.
153
154 ---
155
156 ## Monitor Summary of CPU Usage Across Servers
157
158 The Summary of CPU usage across servers of your environment shows CPU usage patterns across individual server instances.
159
160 In the [Servers monitoring dashboard](#view-server-metrics), the Per-Server CPU chart shows:
161
162 - **Minimum CPU**: The lowest CPU percentage used by a server instance at a given time.
163 - **Maximum CPU**: The highest CPU percentage used by a server instance at a given time.
164 - **Average CPU**: The mean CPU usage across all server instances at a given time.
165
166 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.
167
168 ---
169
170 ## Monitor Summary of Memory Usage Across Servers
171
172 The Summary of Memory usage across servers of your environment shows memory consumption patterns across individual server instances.
173
174 In the [Servers monitoring dashboard](#view-server-metrics), the Summary of Memory chart shows:
175
176 - **Minimum Memory**: The lowest memory percentage used across instances at a given time.
177 - **Maximum Memory**: The highest memory percentage used across instances at a given time.
178 - **Average Memory**: The mean memory usage across all instances at a given time.
179
180 This breakdown helps you identify if specific server instances are consuming excessive memory or if memory usage is consistent across your infrastructure.
181
182 ---
183
184 ## Monitor Server Restarts
185
186 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.
187
188 In the [Servers monitoring dashboard](#view-server-metrics), the Server Restarts chart shows the number of restarts across your server instances over time.
189
190 You can also correlate restart patterns with CPU and memory usage to identify potential causes of instability in your environment.