All Products
Search
Document Center

:Troubleshoot high memory usage on Linux instances

Last Updated:Jun 21, 2026

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.

  1. Connect to the ECS instance. For more information, see Connect to a Linux instance by using an SSH key pair.

  2. 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.

    top
    Note

    You can press the lowercase letter q to exit the top command.

    Press M to sort processes by their memory usage. The following example shows that the process with PID 13183 is consuming the most memory.

    image

    The following tables describe the system summary and process metric fields.

    Fields in the system information summary and process list

    Fields in the system information summary

    Field (row)

    Description

    top

    General system information.

    • The current time.

    • up: the system uptime.

    • user: the number of active users.

    • load average: the average run queue length over the previous 1, 5, and 15 minutes.

    Tasks

    Process statistics by state.

    • total: the total number of processes.

    • running: the number of running processes.

    • sleeping: the number of sleeping processes.

    • stopped: the number of stopped processes.

    • zombie: the number of zombie processes.

    %Cpu(s)

    CPU utilization breakdown.

    • us: the percentage of CPU time spent running user processes.

    • sy: the percentage of CPU time spent running kernel processes.

    • ni: the percentage of CPU time spent running user processes prioritized by using the nice command.

    • id: the percentage of time for which the CPU remains idle.

    • wa: the percentage of CPU time spent waiting for I/O.

    • hi: the percentage of CPU time spent servicing hardware interrupts.

    • si: the percentage of CPU time spent servicing software interrupts.

    • st: the steal time.

    MiB Mem

    Memory usage statistics.

    • total: total physical memory.

    • free: available memory.

    • used: used memory.

    • buff/cache: memory used for kernel cache and buffers.

    MiB Swap

    Swap usage statistics.

    • total: total swap space.

    • free: available swap space.

    • used: used swap space.

    • avail Mem: estimated available memory for starting new applications.

    Fields in the process list

    Field (column)

    Description

    PID

    The PID.

    USER

    The username of the process owner.

    PR

    The scheduling priority of the process. A smaller value indicates a higher priority.

    NI

    The priority specified by the nice command for the process.

    VIRT

    The amount of virtual memory used by the process.

    RES

    The amount of physical memory used by the process.

    SHR

    The amount of shared memory used by the process.

    S

    Process status.

    • R: running

    • S: sleeping

    • Z: zombie

    • D: uninterruptible sleep

    • T: traced or stopped

    %CPU

    CPU usage percentage of the process.

    %MEM

    Physical memory usage percentage of the process.

    TIME+

    Total CPU time used by the process.

    COMMAND

    Command that started the process.

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.

  • Use the top utility to find the PID of the memory-intensive program and terminate the process using one of the following methods:

    Warning

    Before you terminate a process, make sure that you understand what the process does to prevent unplanned service interruptions.

    • Run the sudo kill -15 <PID> command to terminate the process.

    • Terminate the process in the interactive mode of the top command. For more information, see Terminate a process by PID.

  • If you suspect the process is malicious, perform virus detection and removal.

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