Buy enough RAM and you don't need a pagefile.
Since Windows NT4 Server, I've been playing around with pagefile settings. The best thing to do on a server is to buy enough RAM and turn off pagefiles completely. If you have enough RAM, you never need a pagefile. For 99% of servers this works. If you don't trust turning off a pagefile, set a fixed size that's less than your RAM. The swap is not a mirror to your RAM. It's overflow. Remote desktop servers, where you actually have users, are probably the only servers I'd generally leave pagefiles on. I would still set a fixed maximum size. These days I buy enough RAM and turn off swap, because I rather have that disk space be available. I also prefer not to reduce the life of my server's smaller sized boot SSD unnecessarily. Data should never be stored on the boot disk of servers. If you must have a pagefile, it was actually better to set a fixed size so it didn't fragment, especially with HDs. I used to find servers with hugely fragmented pagefiles and I would turn them off to remove them and defragment the disk and turn on pagefiles with a fixed size to get a contiguous pagefile space. It would noticeably speed up operations. Back when Windows 2000 Server and Server 2003 were in use, they were 32bit; I found 1GB page file sizes to be optimal for speed for 2GB, 4GB & 8GB RAM. At 4GB, I actually started turning off swap and those old systems actually worked better. With 32 bit systems, 4GB was the maximum contiguously addressable RAM and setting larger pagefiles just caused a lot more unnecessary swapping to disk. Leaving it to Windows also allowed some runaway processes to fill up disk, during which, you could not gain desktop access easily if your server was tuned to prioritize background tasks. I converted servers to fixed pagefiles, at first. Eventually, I experimented with turning them off and they actually ran better. I know there's an article around 2011 by some dev, running Windows desktops and testing swap, saying to let windows manage your pagefile, but that's for user systems, not servers with multiple users and multiple user access. He tested his single user filesystem desktop, not a server. I turn pagefiles off on my own Windows servers, because I buy my systems with enough RAM. I rarely, if ever, go to swap. You reboot every month on the 2nd Tuesday anyways, so there's no issue with RAM getting weirdly fragmented with overhead to manage that fragmentation. If you never crash, you don't need dumps, so you don't need pagefiles either. You can turn it back on when you experience issues and need a full dump. Windows still provides a minidump without a pagefile. If you periodically run standard windows maintenance scans, your system will rarely, if ever crash. Windows Maintenance 2
P.S. Back when it wasn't a monolithic patch release, you could actually keep windows runnig multiple months if you stopped services before applying a patch. You only have to reboot with a kernel or system level patch. The monolithic patch has too many services and you'd have to stop them all. It's easier to just let it reboot now, since you cant stop one service, patch, then move on to the next one. You have to stop them all, and remember to restart them all. You might as well just reboot. Pagefiles were invented in the 90s for Windows because RAM was expensive. You needed more RAM back then and the pagefile allowed you to compensate for not buying enough expensive RAM. Now, it just allows manufacturers to sell cheap underspec'd systems to users that don't know any better. You still see stupid 4GB RAM and 8GB RAM systems being sold out there. It's also there to allow for users not to upgrade their hardware when the next newest OS comes out. That Pagefile is used to compensate for old systems and cheap systems. So for users on the cheap, yes, leave the pagefiles alone, since they won't know how to configure it properly anyway. For sysadmins, you should be buying enough RAM for the system you want to use. I should add that Database systems shouldn't be needing swap. If you're configuring a database server with swap and it actually uses that swap, you've misconfigured your server and your database. They access disk anyway. Accessing swap means accessing disk twice. Databases are generally configured to know how much real physical RAM you have and accommodate. They should be handling the disk access on their own. I think too many people read the old "rule of thumb" of "set swap to 1.5x RAM" back in the 90s and never actually tested when RAM reached 1GB, then 2GB, then 4GB. That's outdated. It's been outdated since RAM hit 256MB. At 256MB and 512MB, 1x was better than 1.5x. I tested multiple systems. 512 MB swap was actually better for systems that had 1GB max RAM on the motherboard, and 1GB swap was actually better for 2GB and 4GB and even later 8GB max RAM systems, back when the bus speeds were stuck to only 100Mhz. For 8GB and beyond, after bus speeds finally increased beyond 100Mhz, and disk got larger, it was actually better to set swap to between 1/2x to 1x RAM if you needed swap, probably no more than 16GB of swap. If you needed more than that, you didn't buy enough RAM. For servers, it was better to keep it fixed, especially on HDs or RAID that use HDs. It was better still, to just have enough RAM for you system and never go to swap. If you bought 48GB or more RAM, you really shouldn't need swap at all. Even with faser SSDs, they're still slower than RAM. I don't have the results of my tests anymore, because that was from more than 1 & 2 decades ago. I still know my results and I stand by my assertions. |