Symptoms
High memory usage on a Linux instance can cause the following symptoms:
The system is sluggish, service response times increase, and application performance degrades.
In the ECS console, you notice high memory usage on the instance. A memory usage percentage greater than 80% is generally considered high.
You receive an alert that memory usage has exceeded the configured threshold.
Possible causes
Common causes of high memory usage include:
Abnormal processes or services are consuming a large amount of memory.
The workload from your applications is too high, and the instance's physical memory is insufficient for the workload.
Procedure
Check memory usage with top
Follow these steps to resolve the high memory usage.
Connect to the ECS instance. For more information, see Connect to a Linux instance by using an SSH key pair.
Identify the processes that are consuming a large amount of memory.
Run the following command to view CPU, memory, and other resource usage by process.
topNoteYou can press the lowercase letter q to exit the top command.
Press
Mto sort processes by their memory usage. The following example shows that the process with PID 13183 is consuming the most memory.
The following tables describe the system summary and process metric fields.
Resolve high memory usage
The following table lists common causes of high memory usage and how to resolve them.
Problem description | Cause | Solution |
A process consumes excessive memory over an extended period. | An abnormal program or process is consuming excessive memory. |
|
A normal process consumes a large amount of memory for an extended period. | The process is legitimate but consumes excessive memory during operation. | If the instance is experiencing a memory bottleneck, choose a strategy based on your business needs.
|
A process experiences occasional, brief memory spikes. | Traffic spikes or scheduled tasks cause a short-term memory surge. |
|
No single program or process is consuming a large amount of memory, but the overall memory usage is high. | The memory required for normal operation on the instance exceeds the configured memory size of the instance. | If the instance has a memory bottleneck, change the instance type. For more information, see Change the instance type. |
References
For information about how to troubleshoot and resolve high memory usage on Windows instances, see Troubleshoot and resolve high memory usage on Windows instances.
If you need to collect memory metrics in advance for anomaly analysis, you can use the
atoputility. For more information, see Monitor Linux system metrics with atop.