Think about the page file (PF) as "extra RAM." When you don't have enough RAM, the data is sent to the PF. There is a memory subsystem called Virtual Memory Management (VMM). Virtual Memory's (VM) *real* size is limited to RAM+PF. When processes load more data (commit charge) than is available in RAM, less recently used data from RAM will page to disk (pagefile.sys) freeing up RAM for the requesting process. It's faster to call that data from RAM, than from the HDD, VMM will store the most recently used data in RAM. Paging to disk is when data is being transferred between RAM and the PF. You can sometimes "see" this happening when you alt-tab between two applications with a lot of data loaded. The HDD will be very active for a short period of time. This is a *basic* description of paging. There is definatly more going on behind the scenes, but that isn't as relative to sizing the pagefile.
To measure your VM usage, give your system a workout; play some games, open large files, whatever you would do in a normal day. In fact this is probably better measured after your system has run for a day or so. Then open Task Manager and go to the Performance Tab and look at the Commit Charge (K) box. Total is the total amount of VM your using. Peak is the maximum VM usage since you booted the computer. Limit is your VM limit.
To size the PF, take your Peak and subtract your Physical Memory Total (RAM). For example, on my work laptop, I have a Peak of ~650MB and 512MB (~500) RAM, so that's ~150MB. In order to run everything I have loaded at once, I would need a minimum of 150MB PF. However, I want room to breath. If I loaded just one more thing, I would receive an out of memory error message, and would have to close something to open something new. So you should increase your Peak by about 25% first, this will account for your breathing room. OK, so (650*1.25)-500=~300. I should have a 300MB PF on this system.
If you require a PF, you should set the minimum and maximum size to the same value. If you set a range, the PF can grow, but this will cause file fragments in the PF. The built in defragmenter cannot correct fragments in the PF, only 3rd party software can. The more fragments in your PF, the slower it will operate. Also, if you sized it properly, your PF will never need to grow.
Now what if (Peak*1.25)-RAM is negative? Well, that means you don't need a PF, and you disable the PF.
**Note, there is a bit of controversy about this setting, and it's performance benefits. Some people claim faster load times in applications, or overall smoother performance. Others say this is a placebo effect.**
What I'm telling you is, if this calculation is negative, the system does not need the extra memory from the PF for VM. There is enough RAM to supply all the VM needs. If new data is loaded, the system with a PF would be paging memory to disk, one without will not. Now, when the system is paging, the HDD is very active, and this slows down your machine. If this happens, say during the middle of a game, your frames/second will likely take a hit. On slower systems (like this laptop I gave in the example above) you can really feel paging because of the slower HDD. Also note, this doesn't mean your disabling VMM, just the size of the memory available to VMM. This means paging will still happen, it just won't be transferred to the HDD.
This may be where some performance gains could be measured. If the system doesn't have to page memory from RAM to the PF (because the PF is disabled), then something like loading a game (or a level in a game) might load faster.
It should be noted, while overall system test (like 3Dmark) do not show an increase in performance, they don't show a decrease either. I suspect this has to do with how and when paging happens. These programs aren't doing anything to cause paging while the system is being tested. Well, you can't test a tweak to the page file, when the system isn't paging. As users, however, we do experience paging...
YMMV with disabling the page file. If you have a negative figure in the calculation of your page file size, and don't feel comfortable with disabling the PF, set it to a small amount like 100MB.
Now, the only thing left is the PF's location. Like many things, this can vary a lot depending on the number of drives and controllers in your system. In general you want it on the fastest drive/controller available, if the speed of two drives is similar, put it on the secondary drive. If the secondary drive is slower, it's better to keep it on the same drive as the OS. In multi drive/controller setups it can be very complicated.
If I left anything out, or your notice anything that's incorrect, let me know.
EDIT: As noted by Ranma_Sao, you cannot obtain a full memory dump if your page file is less that your total RAM. When the system dumps, it creates a file on the HDD with the entire contents of your RAM. The data in the dump files is very usefull when troubleshooting BSODs, with the proper tools. Ranma_Sao has offered many times in the past to diagnose these, so at lease be aware of this. Some BSODs prevent you from booting into windows to make changes to the PF, so this can be important. In other cases, where windows is booting, but still generating a BSOD at a later time, you could increase the PF size to get this information.
EDIT2&3: Corrceted terms for clarity.
To measure your VM usage, give your system a workout; play some games, open large files, whatever you would do in a normal day. In fact this is probably better measured after your system has run for a day or so. Then open Task Manager and go to the Performance Tab and look at the Commit Charge (K) box. Total is the total amount of VM your using. Peak is the maximum VM usage since you booted the computer. Limit is your VM limit.
To size the PF, take your Peak and subtract your Physical Memory Total (RAM). For example, on my work laptop, I have a Peak of ~650MB and 512MB (~500) RAM, so that's ~150MB. In order to run everything I have loaded at once, I would need a minimum of 150MB PF. However, I want room to breath. If I loaded just one more thing, I would receive an out of memory error message, and would have to close something to open something new. So you should increase your Peak by about 25% first, this will account for your breathing room. OK, so (650*1.25)-500=~300. I should have a 300MB PF on this system.
If you require a PF, you should set the minimum and maximum size to the same value. If you set a range, the PF can grow, but this will cause file fragments in the PF. The built in defragmenter cannot correct fragments in the PF, only 3rd party software can. The more fragments in your PF, the slower it will operate. Also, if you sized it properly, your PF will never need to grow.
Now what if (Peak*1.25)-RAM is negative? Well, that means you don't need a PF, and you disable the PF.
**Note, there is a bit of controversy about this setting, and it's performance benefits. Some people claim faster load times in applications, or overall smoother performance. Others say this is a placebo effect.**
What I'm telling you is, if this calculation is negative, the system does not need the extra memory from the PF for VM. There is enough RAM to supply all the VM needs. If new data is loaded, the system with a PF would be paging memory to disk, one without will not. Now, when the system is paging, the HDD is very active, and this slows down your machine. If this happens, say during the middle of a game, your frames/second will likely take a hit. On slower systems (like this laptop I gave in the example above) you can really feel paging because of the slower HDD. Also note, this doesn't mean your disabling VMM, just the size of the memory available to VMM. This means paging will still happen, it just won't be transferred to the HDD.
This may be where some performance gains could be measured. If the system doesn't have to page memory from RAM to the PF (because the PF is disabled), then something like loading a game (or a level in a game) might load faster.
It should be noted, while overall system test (like 3Dmark) do not show an increase in performance, they don't show a decrease either. I suspect this has to do with how and when paging happens. These programs aren't doing anything to cause paging while the system is being tested. Well, you can't test a tweak to the page file, when the system isn't paging. As users, however, we do experience paging...
YMMV with disabling the page file. If you have a negative figure in the calculation of your page file size, and don't feel comfortable with disabling the PF, set it to a small amount like 100MB.
Now, the only thing left is the PF's location. Like many things, this can vary a lot depending on the number of drives and controllers in your system. In general you want it on the fastest drive/controller available, if the speed of two drives is similar, put it on the secondary drive. If the secondary drive is slower, it's better to keep it on the same drive as the OS. In multi drive/controller setups it can be very complicated.
If I left anything out, or your notice anything that's incorrect, let me know.
EDIT: As noted by Ranma_Sao, you cannot obtain a full memory dump if your page file is less that your total RAM. When the system dumps, it creates a file on the HDD with the entire contents of your RAM. The data in the dump files is very usefull when troubleshooting BSODs, with the proper tools. Ranma_Sao has offered many times in the past to diagnose these, so at lease be aware of this. Some BSODs prevent you from booting into windows to make changes to the PF, so this can be important. In other cases, where windows is booting, but still generating a BSOD at a later time, you could increase the PF size to get this information.
EDIT2&3: Corrceted terms for clarity.