As standard, the Windows server operating system will do a fine job of managing your page file however, in some cases, it can be more efficient and actually speed up system performance if you set the page file to a static size.
For example, suppose you have a slower spinning disk. In that case, if the page file follows its default behaviour, which is to shrink and grow as required dynamically, a lot of slow disk reads and writes need to happen constantly to allocate sometimes GB’s worth of disk space to perform an operation. You might also find that you have a lot of free disk space if you are on SSD or NVMe based disks so there is no need to try and save so much space by having it shrink back down to a minimal size when it is not in use, it is better to have it instantly ready to be available on demand.
To access the page file settings, right-click on the start menu and click on ‘System’ then on the System page scroll down to the bottom on the right-hand side of the window and under ‘Related settings’ click ‘system info’ this will bring up the familiar system information page in windows that shows your CPU type and how much ram you have. From here on the left and side click ‘Advanced Settings’
The system properties window will have opened now, click on the ‘Advanced’ tab then under ‘performance’ click the ‘settings’ button, and then in the new window, click ‘Advanced’. Now you will see ‘Virtual memory’. This is the paging file (often referred to as the swap file in Linux), you will see the ‘Total paging file size for all drives:’ value, it is likely a random none uniform amount.
Click change and then untick the box titled: ‘Automatically manage paging file sizes for all drives’, now select the radio check box called ‘Custom Size’ in here set the initial and the maximum size in MegaBytes (MB) to the same value, a good starting point is 50% of your system Ram, so if you have 16GB Ram you can set this to 8GB which in MB is 8192, enter this value into both boxes then click the ‘Set’ button and then click ‘OK’ the server will now reboot in order to set the page file size to a static one.
The file will never shrink or grow, meaning it is permanently available when needed.
There are some cases where you may wish to turn the page file off altogether. Suppose you are quite sure you have enough ram. You do not want anything that could potentially run in ram being slowed down by being transferred to your disk-based page file you can also set the page file to ‘off’ in this same location. In that case, this will force everything to run in ram, be aware that this can cause instability if you run out of ram.