All Products
Search
Document Center

Elastic Compute Service:How do I configure the virtual memory of a Windows instance?

Last Updated:Apr 14, 2025

In Windows systems, virtual memory is typically referred to as a paging file (Pagefile). When the memory of a Windows system cannot meet the requirements of all currently running processes, the system transfers some infrequently used data from memory to virtual memory on hard drives. Proper configuration of virtual memory can improve system performance and stability.

Important

Enabling virtual memory may degrade memory I/O performance. When an Elastic Compute Service (ECS) instance is low on memory, we recommend that you change the instance type to increase memory. If you want to enable virtual memory, follow the guidelines in this topic for configuration.

Scenarios

In the following scenarios, you may need to enable virtual memory:

  • Insufficient memory or high memory usage

    • If your system has limited memory (such as 4 GB or less), you may frequently encounter out-of-memory incidents. In this case, you can enable virtual memory to help the system handle more concurrent tasks or applications.

    • If system monitoring tools indicate that memory usage frequently approaches 100%, you can consider increasing memory or enabling virtual memory to ensure system stability. Otherwise, some applications or the system itself may crash.

  • Running large applications or multitasking

    In most cases, a significant amount of memory is required to run large applications, such as large graphics and design software (such as Adobe Photoshop), data analysis software (such as big data processing tools), and games. You can enable virtual memory to ensure that the applications run smoothly.

Configuration recommendations

Location of virtual memory

  • Do not use the C drive. We recommend that you do not place the paging file on the C drive, which is used as the system disk on the instance in most cases. The C drive typically stores the operating system and application files and has limited space. Configuring the paging file on the C drive may lead to system performance degradation and availability issues.

  • Use other partitions. We recommend that you configure virtual memory on partitions other than the C drive to reduce the load on the C drive and improve the access efficiency of virtual memory.

Size of virtual memory

  • Automatic management of virtual memory: We recommend that you allow the system to automatically manage the size of virtual memory. Windows can dynamically adjust the size of the paging file based on system usage to optimize performance.

  • Custom virtual memory settings: If you have specific requirements, we recommend that you set the initial and maximum sizes of virtual memory based on the size of memory.

    • Initial size: Set it to 1 to 1.5 times the size of memory. This provides sufficient space to handle most memory demands without frequent adjustments to the paging file size.

    • Maximum size: Set it to 2 to 3 times the size of memory. This provides sufficient buffer space to ensure that the system can still run normally under high load conditions.

Other recommendations

  • Monitor performance. Regularly monitor system performance, especially when large applications or games run. If you find that the system frequently uses virtual memory, consider increasing memory.

  • Prevent fragmentation. Regularly defragment your disks to reduce fragmentation issues and ensure the efficient operation of virtual memory.

  • Ensure normal system operation. Check the applications that are using virtual memory to ensure they are running properly.

Configure virtual memory

Note

This section describes how to configure virtual memory in Windows Server 2016. Operations may vary based on your environment.

  1. Use Workbench to connect to a Windows instance over RDP.

  2. On the Windows Server desktop, right-click the image icon and select System.

  3. Select Advanced system settings.

  4. On the Advanced tab, click Settings in the Performance section.

    image

  5. Click the Advanced tab and then click Change in the Virtual memory section.

    image

  6. In the Virtual Memory dialog box, select Automatically manage virtual memory, or clear the check box and specify a virtual memory size or disable virtual memory based on your needs.

    • Automatically manage virtual memory

      1. Select Automatically manage paging file size for all drives.

      2. Click OK.

      image

    • Specify a virtual memory size

      1. Clear Automatically manage paging file size for all drives.

      2. Select a drive where you want to store the virtual memory file.

      3. Select Custom size, configure the Initial size and Maximum size parameters, and then click Set.

      4. Click OK.

      image

    • Disable virtual memory

      1. Clear Automatically manage paging file size for all drives.

      2. Select a drive where you want to store the virtual memory file.

      3. Select No paging file and click Set.

      4. Click OK.

      image

  7. Restart the ECS instance for the configuration to take effect.