This topic describes how to identify and resolve the causes of high memory usage on a Windows instance, which can lead to issues such as system sluggishness.
The examples in this topic use Windows Server 2022. The user interface may vary slightly across different operating system versions. Refer to the UI of your operating system.
Symptoms
An ECS instance that runs Windows may stutter and its internal services may respond slowly. In the ECS console, memory monitoring shows high memory usage, or you receive alerts for high memory usage.
Possible causes
Common causes of high memory usage include the following:
-
Abnormal processes or services are consuming a large amount of memory.
-
Heavy workload on your applications requires more memory than the physical memory available on the instance.
Procedure
To identify the cause of high memory usage, follow these steps.
Check total memory usage
Use the built-in Windows Task Manager to view memory usage.
-
In the search box in the lower-left corner of the Windows desktop, enter Task Manager, and press
Enterto open Task Manager. -
In Task Manager, click the Performance tab, and then click Memory in the left pane to view memory usage.
The right pane displays memory usage details, including total capacity, memory that is In use (compressed), Available memory, and the memory usage percentage.
View per-process memory usage
Use the Windows Resource Monitor to view resource usage, including memory usage per process.
-
In the search box in the lower-left corner of the Windows desktop, enter Resource Monitor, and press
Enterto open Resource Monitor. -
In Resource Monitor, click the Memory tab to view the memory usage of each process. Check the value in the Commit (KB) column to identify processes that consume large amounts of memory. Then, based on your business workload, determine whether the process behavior is expected.
Physical memory usage is composed of the following parts:
-
Hardware reserved memory: A portion of physical memory that the system reserves for hardware devices. These devices include GPUs (Graphics Processing Units), sound cards, network cards, and Bluetooth modules. This reserved memory cannot be used by standard applications and is dedicated to supporting the normal operation of hardware devices.
-
In use memory: Memory used by processes, drivers, and the operating system.
-
Modified memory: Memory whose contents must be written to disk before it can be used for other purposes.
-
Standby memory: Memory that contains unused cached data and code.
-
Free memory: Memory that contains no valuable data. This memory is used first when processes, drivers, or the operating system need to request more memory.
-
Cache: When a file is opened, the system stores the file in a cache for faster subsequent reads and writes. In Windows Server 2008 R2 and later, the use of this cache is limited. This ensures that sufficient physical memory remains available for applications, even when the cache is large.
-
View system process memory usage
If Task Manager and Resource Monitor do not show any processes that consume a large amount of memory but the instance's memory usage is still high, the cause may be high memory consumption by system processes. In this case, you can use Microsoft's RamMap tool for further analysis. This tool can show how much file data is cached in RAM by system processes and how much RAM is used by the kernel and device drivers.
-
Download and decompress the RamMap tool.
Go to the Microsoft website to download RamMap. After downloading, decompress the package.
-
Double-click RamMap to open it and view memory usage details.
By default, RamMap opens to the Use Counts tab. The table lists memory types, such as Process Private, Mapped File, Shareable, Page Table, Paged Pool, Nonpaged Pool, and Metafile, and shows the usage in columns such as Total, Active, Standby, Modified, Zeroed, and Free. At the top, a color-coded bar chart shows the proportion of each type.
The tabs in the RamMap tool display resource usage information in different ways. The following list describes each tab.
-
Use Counts: A summary of usage by type and page list.
-
Processes: The working set size of each process.
-
Priority Summary: The standby list sizes by priority.
-
Physical Pages: The per-page usage of all physical memory.
-
Physical Ranges: The physical memory addresses.
-
File Summary: File data in RAM, grouped by file.
-
File Details: Individual physical pages, grouped by file.
-
Resolve high memory usage
The following table describes the causes of and solutions for high memory usage.
|
Issue |
Cause |
Solution |
|
A single user application or process consumes excessive memory for an extended period. |
An abnormal application or process is consuming excessive memory. |
In Task Manager or Resource Monitor, locate the application consuming the most memory, right-click the application, and then select End task. Warning
Before you end a process, make sure that you understand what it does to avoid causing a service outage. |
|
The workload requires more physical memory than the instance provides. |
Evaluate your workload and change instance type to add more physical memory. |
|
A single application or process occasionally has brief, infrequent spikes in memory usage. |
Traffic bursts or scheduled tasks cause short periods of high memory consumption. |
|
References
-
For information about high memory usage on Linux, see How to resolve high memory usage on a Linux instance.
-
Use Microsoft's Process Explorer to view detailed information about process memory usage.
-
Use Microsoft's Poolmon tool to track and identify the source of kernel memory pool consumption by pool tag.