Optimise your Swapfile

Page 1

GIVE WINDOWS A HUGE BOOST! P54

FREE DVD 56 GAMES

ISSUE 230 SEP 2009

PERFORMANCE GEAR & GAMING

ISSUE 230 IT CAN’T RAIN ALL THE TIME

IT CAN’T RAIN ALL THE TIME

AMD: still best for budget gaming?

“A BRUTAL CROSS BETWEEN DIABLO AND ROGER RABBIT”

Dave loots and shoots in Borderlands

Pixel-perfect shooters 12 gaming mice in the labs

WWW.PCFORMAT.CO.UK

THERE’S MORE… Gigabyte: behind the scenes Core i5 specs revealed Real Time Strategy classics!

Men Warof ARMA 2: WAR HAS NEVER FELT SO REAL

PCF230.cover 1

HOTWIRED! GET MORE FROM YOU RIG

¤ DIY WATER COOLING ¤ MAKE A CASE SENSOR ¤ CORE i7 OVERCLOCKING

EVEN MORE…

NOVATECH X90 GTX PRO MESH SLAYER PC COOLIT DOMINO ASUS XONAR DS PROTOTYPE: UNLOCK ZOTAC ION MOBO TRINE, ANNO 1404 GENETIC SHACKLES

Issue 230 Sep 2009 £5.99 Outside UK & ROI £6.49

15/7/09 10:10:25 am


Illustration: Paul Blachford 54

PCF230.feature1 54

September 2009

16/7/09 8:20:22 am


O You pti m r S ise w W apfi le Tak Ne e pa il M ge oh file r b op en tim ch isi ma ng rks to all the the ext opt rem ion e, a s s

ew ab ere the out i aske an d tho re fo t , r a i s we r so ug h re w ye s e s i s . I t ’ m a s me a n e a t we e gru r, ev t ’s u one so m or ‘so d wh nswe ’d ge r e a n t i n e r yo g l y h o f t sw -calle y. Ov ne che g no ne m ead hose me me’, en w rs t ap er d d x a i e i p a n s a t q a a n c Th be nd e, n kes ou ue r ti file, best the a ll f a c t s a y a s s m t p o t i y s m ye i t t s sw qu us t ’s l o ap m e s te m n , o ys te m e t h o a r s w e f r e a o m e o io n h e we e n file stio d vic orgo l con e t y f tim s tha m m wo o r e m it s m a d s ; e’ v , a k n w t i m t t e cl u p e o e s t a the rse t y, fra or y own nag no sw e hea a t a s a a s n a b si o n f k he fir han gm , thr par ed fi ap rd a b s p a o u t s a ll o u t u i s t e fi g e t h ov n t wa A hu t tim know nted ee ti ition le, on le, fi ll the me , t y M ge file e W er il t e , i the xed n i d . m w a re g h ef s t , a k in d ga h e i aro o w r a g h e ic e t m a i Th plem croso ason a v ow i n . s m e e com und to ir t s ’ e n ys te h e n is t fac nte ft ha for a k ua t i pu far l ss ed m l the esta t so d vir s ta ll of o t a g , it com So w ing w nger irl ’s vir sub men many tual mckled this, for sce pre e de orld than Wi tual mject i t in it peo em the is th t ha o e s p nd op nari hens cided . ow emo s, par self t le ca ry w ubje hist tg we tima os an ive lo it w s s ry tic o h ll it ith ct a ori en l a ’ era c i . inc ha ula ow d l n o s l A n a t s s s k h d W l a l o s e o n ee ev rly ba e w in lly b a l e b u t o g er s ee t c w in t a d u d w j r i u o t l o t l o st ns me he w hich l the tim ion n im hen y un ong ws he t p t h . , t u d e ha ag 3.0 ple you er hin i d a e p f w y i s all e fil ing t are with we any, ffer e to an me con sto g d h nte si od be or if e. So le go imm som ’ll lea is ac ent ok a d as f y a r t n be d in er s o ore, ou’v o m l of ens e pr n a uall en to meth we t e ne atte gett ely h etty lot an y pit set-u ing n hink ver e r if y ing a elpfu nove d as jus falls p yo ew a you’r ven h ou th n opt l bey l t d , to ur p lon e g ea ink im on is a m so d o r g n h me age fi the ing t d of a you k ed o w an dy intrig le, ho ay. F lear page now to n file it kn uing w to a rom ow tri h ab cks void t ow b ou e t. that he us st are ua l

September 2009

PCF230.feature1 55

55

16/7/09 8:20:29 am


Optimise your swap file

When someone mentions swap file or page file to you what are they talking about? Well, technically Windows 9x has a WIN386 swap file, while Windows NT/2000/XP/Vista/7 use a PAGEFILE file. You can see why the two phrases are used interchangeably. However, the confusion doesn’t stop there. All of this is connected to the Windows virtual memory system, which is what we’re really talking about here. Virtual memory enables an OS to virtualise the physical memory space to another storage medium, usually a hard drive. To do this both the kernel of an OS and the processor it’s running on need to support the function. Over 20 years ago that might have been an issue, but not today. The whole point is that when an app requests a block of memory it may see itself being given a block of real memory. In reality only part, or none at all, of this could be ‘real’ with

memory as a whole. This enabled a processor that could be limited to just 4MB of real physical memory to address potentially gigabytes of virtual memory, albeit with that data store on a hard drive. Even today systems with 2GB of memory can easily require virtual memory and with the majority of people running 32-bit versions of Windows, 4GB is the practical physical memory accessible. So while this is a lot of memory, running demanding apps, such as an email client, productivity suite, image editing software, virus checkers and so on – this can simply go. So with virtual memory still an issue, even for PCs with 4GB of physical memory installed, the original question still stands: What is the best configuration for your Windows page file, if you need one at all? The plan here is to test a whole range of

Right Oops. Sorry 32-bit users you’re stuck with 4GB of memory, less in fact

“The virtual memory system works on pages of 4K, which are swapped in and out of real memory as a whole” the rest stored temporarily virtualised on the hard drive. If an app requests memory that’s stored off in this virtual world, a ‘page fault’ is generated, the virtual memory is swapped over to real memory in chunks called ‘pages’ and everything carries on. The primary reason why this is a helpful thing is found back in the days when the amount of real memory a processor could access was limited to mere megabytes. The virtual memory system typically works on pages of 4K, which are swapped in and out of real

56

PCF230.feature1 56

scenarios, some of them typical and others not so ordinary to reveal the optimal configuration for you. Our first problem is just how to test and benchmark the swap file. We want to test a whole range of situations from 1GB installs to 6GB installs. That means a 64-bit Vista installation to keep everything consistent. As we need a low-memory situation we’ll base it on a 1GB Windows Vista installation. To benchmark this we’ll need something that’ll require a large block of memory and manipulate that data.

To do that we run a benchmark that creates a large image file in memory and does various manipulations with it, from simply scrolling it, to rotation. We time how long it takes to complete each stage and get results from completing the image write and read, and rotation speed timed in seconds and MB/s depending on the operation. You might have spotted something here, isn’t this just a drive-speed test? Well, yes and no. We are testing the speed of the swap file here, it just so happens that’s dependant on the speed of the medium the swap file is stored on, but still how the swap file is stored is going to play a part, just as much as what it’s stored on.

To the test chamber!

Below Access to the page file gets pretty hectic once memory starts getting tight

To begin we need a control, which is going to be a standard Windows Vista 64-bit installation with a managed page file all running from the same partition on a Hitachi 250GB Deskstar drive. We’ll just install the OS, update the drivers and let Windows manage the page file in whatever manner it sees fit. With just 1GB of memory the system creates a 1.3GB page file and at rest is using around 660MB of that with little actually running. Checking up on that file it’s already split into two fragments. Under benchmark conditions the page file increases to 3.2GB and has now fragmented into five sections, remember this is on a clean 250GB installation so there are hundreds of gigabytes of empty space to use. You can imagine how on a real-life drive this fragmentation could become far worse over time as the available free space becomes limited. This is the first of what are the conventional ‘spinning disk’ tests and on the whole are what we’d expect the vast majority of people to be running. The next four tests are all based on different variations around single drive and twin drive configurations. The

September 2009

16/7/09 8:20:42 am


Optimise your swap file

As we’ve described we’re creating a large image in memory and manipulating it various ways, such as loading, saving, rotating and scrolling it. Running on a 1GB system this far exceeds the available free memory and forces Windows to rely on the page file for up to 3GB of extra memory. We time how long each operation takes as we can see how fast the system is at performing each one, plus the available bandwidth the page file has. For every scenario we performed multiple runs to help eliminate general system noise from the equation.

Technical analysis – benchmark results: what they are and what they mean Enlarge

TIME IN SECONDS: QUICKER IS BETTER

3

6GB MEMORY - SMALL PAGE

3.24

6GB MEMORY - NO PAGE

7

RAM DRIVE DEDICATED SSD

49.08

SSD COMPLETE INSTALL

60.65 116.16

SPLIT OVER 2 DRIVES USER DEFINED

169.28

DEDICATED SATA DRIVE

119.94 183

DEDICATED PARTITION

185.61

WINDOWS MANAGED

20

Save

40

60

80

100

120

140

160

180

200

220

240

260

280

300

TIME IN SECONDS: QUICKER IS BETTER

10.36

6GB MEMORY - SMALL PAGE

11.18

6GB MEMORY - NO PAGE RAM DRIVE

17.24

DEDICATED SSD

27.73

SSD COMPLETE INSTALL

32.36

SPLIT OVER 2 DRIVES

72.52

USER DEFINED

110.19

DEDICATED SATA DRIVE

58.97 118

DEDICATED PARTITION

105.3

WINDOWS MANAGED

20

Load

40

60

80

100

120

140

160

180

200

220

240

260

280

300

TIME IN SECONDS: QUICKER IS BETTER

6GB MEMORY - SMALL PAGE

10.91

6GB MEMORY - NO PAGE

11.51 11.81

RAM DRIVE DEDICATED SSD

71.04

SSD COMPLETE INSTALL

46.07

SPLIT OVER 2 DRIVES

69.49 95.97

USER DEFINED

124.77

DEDICATED SATA DRIVE DEDICATED PARTITION

118.36

WINDOWS MANAGED

122.04 20

Rotate

40

60

80

100

120

140

160

180

200

220

240

260

280

300

TIME IN SECONDS: QUICKER IS BETTER

8.56

6GB MEMORY - SMALL PAGE

10.63

6GB MEMORY - NO PAGE

16.21

RAM DRIVE

102.37

DEDICATED SSD SSD COMPLETE INSTALL

110.69

SPLIT OVER 2 DRIVES

218.39

USER DEFINED

239.39

DEDICATED SATA DRIVE

241.02 255.6

DEDICATED PARTITION

258.29

WINDOWS MANAGED

20

40

60

80

100

120

140

160

180

200

220

240

260

280

300

September 2009

PCF230.feature1 57

57

16/7/09 8:20:51 am


Optimise your swap file

obvious first test is to run a userdefined, fixed-sized page file, this is the option that tends to be most favoured by people and the thinking behind it makes a lot of sense; creating a fixed page file when Windows is first installed eliminates the chance of fragmentation so provides an optimal single continuous file. If you make this large enough then apart from losing a few gigabytes of drive space there’s no real downside. Our next scenario runs along the same lines but does so with the page file stored on its own partition on the same drive. This has been suggested as an optimal solution, but it has been pointed out that this unnecessarily encourages excessive amounts of drive head thrashing. As it ends up with the page file being physically removed from the working data. This certainly rings true for us, we’d imagine in certain situations it would be fine for large sequential writes and reads to the page file, but in reality we’d imagine this is less the case particularly when multitasking. Unfortunately, this is one area our benchmark won’t test very strongly, but we can see how it performs under our heavy single memory load. Scenario four is running the page file off a secondary SATA hard drive. Before you get up in arms, it’s a similar 250GB 7,200rpm Hitachi Deskstar made within six months of the other drive, so raw performance should be very similar. Otherwise we’re running a fixed user-defined page file as per the other scenarios. We’d expect performance here to be among the best of the ‘spinning disk’ test as the

A fixed result

dedicated SATA line will help eliminate drive thrashing due to separating the page file and system access to the drive. This leads on to the final scenario which was added more as an intellectual test. We were interested to see if running two page files over two drives enabled Windows to perform any sort of intelligent cacheing or even RAID style spanning. If it balances storage against spare access capacity that could offer some benefits and the Microsoft Knowledge Base article seems to allude to that sort of practice.

A solid answer

After testing we’re glad to see that indeed our preferred user-fixed page file certainly performed well. To our surprise it outperformed the dedicated drive to a small degree in some tests, but it was certainly outpaced in others by the dedicated drive; the most notable being the save test. That aside it completed a number of tests 20 to 25 seconds quicker than the managed option. The big surprise is that the split page file was the one that really performed best overall. As you’d expect it at least matched the dedicated drive option in most cases, but in others certainly pulls out a good lead over the user-defined and dedicated drives options. While we have no direct reason for why this should be the case, as we’ve mentioned Microsoft alludes to the fact Windows does intelligently spread the load across multiple page files, depending on which drives are used the least. No matter whether that’s done historically or on the fly, something seems to be working and for the majority of users

When it came to our ‘spinning disk’ results we were somewhat surprised and also vindicated. It’s obvious that a Windows managed page file is by far the slowest option to choose. The benchmark in itself may not be wholly real-world centric, we are testing the Windows managed scenario in the best possible conditions, as far as its concerned at any rate. So with it running up to 70 seconds slower than the fastest ‘spinning disk’ scenarios that’s a potential real drag, even more so under potentially more fragmented conditions. It’s also clear the fixed same-drive partition solution isn’t a good choice either; any advantage gained by the guaranteed defragmentation is then lost by the physical partition separation and increase in drive head seek times, at 58

PCF230.feature1 58

Above The best way to store your page file is in a single defragmented state

least being no better than a system managed option. We’d also contest the idea that turning the page file off on a highmemory system helps improve performance. Our results actually point, if anything, to the opposite, while turning off the virtual memory makes a system vulnerable to a low-memory situation that can cause apps to crash and deny Windows the ability to create memory dumps in crash situations. Something that strikes us as a lose-lose-lose situation. Previously we’ve always recommended a fixed page file as the most sensible option. Windows enables you to specify a minimum size and a maximum, so it makes sense to create a large minimum size that you’re happy with. We’d recommend at least

we’d imagine is the optimum and most achievable solution. As much as we love our spinning hard drive friends and their penchant for storing grotesque amounts of video in all of its many fleshy forms, they’re still damn slow. Those mirrored spinning surfaces may look shiny and attractive but get too close and the horrific realisation that their access times can be measured in geological ages claws at our souls as much as our own reflected twisted images. Which is to say they’re a bit slow. While still expensive in comparison to ‘spinning disks’ you can certainly pick up 32GB solid state drives for under £100 now and even the more recent 80GB drives are slipping into the £200 price bracket. This definitely puts a solid state boot-drive solution into the price range of most people. The question is what’s the impact of this technology on page file performance?

2GB or better yet 4GB and then choose a larger maximum in case of emergencies, either 6GB or 8GB. Plus in light of our results if you can do this over two different drives then that’s going to be even better, ensuring you get the maximum speed out of your creaking drives.

Switching off the page file quickly made our benchmark throw up this error

September 2009

16/7/09 8:21:8 am


Optimise your swap file

Fixing the file

To get the most from your page file you’ll need to know how to control it. From Windows 95 to Windows 7, the page file has always been controlled through the Advanced settings section of the System Properties Control Panel, press [Windows] + [Break] to open this. Vista and 7 users will also need to click the Advanced system settings link. For all versions of Windows XP/Vista/7 in the Performance section click the ‘Settings’ button, choose the Advanced tab and in the Virtual memory section click the ‘Change’ button. Here you’ll see a list of all eligible connected drives, what, if any, page file they currently have and Windows’ own recommendations. Windows Vista and 7 systems have an additional tick box at the top of the dialogue box that forces a system managed page file and will need to be cleared. Selecting each drive enables you to create a customdefined page file, enable Windows to We decided to run two scenarios, as we’ve already established that a user-defined fixed page file is the way to go, the two options we want to test are with a full Windows installation and as a plain drive with a fixed page file on it. As you’d hope the up-to-date solid state architecture efficiently smothers

manage its own file or to force no page file at all. The important thing is to make sure you click the Set button after each selection, otherwise any changes won’t be permanent. Windows has a couple of foibles that are worth pointing out. By default it’ll create its system managed page file on the boot drive and it’ll opt for 1.5 times the physical memory, moving up to three times this depending on the memory loads. It won’t take advantage of other partitions or drives with more space. This is particularly odd when you consider that even Microsoft admits this isn’t an optimal configuration over at this Knowledge Base article support.microsoft.com/ kb/314482. It advises that running the page file on a separate hard drive is a better option, but it does go on to state that a page file on the boot drive is also required for error logging. While alongside of this Windows has its own

algorithms for determining which drives are used least and will priorities those for page file usage over other partitions or drives.

Clearly the fastest scenario will be running without any page file at all, right? It appears not. By accident we actually left the page file on and ran the benchmark cycle. Spotting our mistake we reran the test with the page file off, to discover it was slower. Only slightly slower, but still slower.

“Clearly the fastest scenario will be running without any page file at all, right? It appears not” the randomness of the mechanical drives, in most cases yielding double the performance, with a halving in most times and a three-fold increase in throughput on the scroll test. As you’d also expect the dedicated driver option also offered a little improvement in performance, though the sheer efficiency of the solid state access system meant the Windows managed file was almost as efficient.

Stacks of memory

We finally come to that scenario we’ve seen a lot of people with a sizeable compliment of RAM touting: turning off virtual memory and doing away with a page file. What we would like to know is just how good a thing it is! To answer these final questions we took a high-memory system that involved installing 6GB of memory into our 64-bit test system.

Either way the results are still staggering in terms of the speed increase over any dependency on using the page file, it’s a ten-fold reduction in wait times and a 40-fold increase in throughput over even the solid state drives, never mind the 100-fold plus increase in throughput over the spinning disks. Again, more from interest than any practical solution we created a 5GB RAM drive and created a fixed page file within this to see what type of overhead that would impose. It pretty much halved the throughput speed showing there is something of an overhead involved with simply running the page file, but in context of the slow drives it’s normally stored on that’s not usually an issue. So what have we learnt? Clearly having lots of memory is a great thing, if you can eliminate the need for Windows to use the page file your life

This simple system setting has served us proud for many a year

is going to be much improved. Having no page file, while it might seem clever on the face of it could slow things down ever so slightly and if you do ever hit a low-memory situation it’s going to cause problems. The page file is also used as a dump area if a crash occurs, turning it off eliminates that feature. We can see anyone with a solid state drive is going to be fine either with a managed or fixed page file. For the rest of us the best solution is to opt for a user-fixed page file and as many people more than likely have a second drive, choose to store two user-fixed page files on both drives. If swapping does occur at least this should keep times to a minimum. ¤

Right Here we see PCMark giving up when the page file is turned off

September 2009

PCF230.feature1 59

59

16/7/09 8:21:22 am


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.