Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Swap File Optimizations?

Cliff posted more than 10 years ago | from the coaxing-out-more-speed-via-organization dept.

Data Storage 177

fastswap asks: "I've got a pretty standard computer with reasonably fast drives. I've got an old 2GB-but-fast drive, and a spare channel on the motherboard. Does it make sense to install the 2GB drive on its own controller and use it for a dedicated, fixed swap file? I figure if the computer's using the swap file, then in the current setup with the swap file on the primary controller, then it's contributing to hard drive thrash exactly when one doesn't want it to (i.e. when the machine needs the swap file). If it is better to have a dedicated swap file on its own controller, is the same true for other operating systems with similar approaches to virtual memory? Since drive space is so cheap now, should the swap file be fixed size anyway rather than letting Windows suddenly get the urge to resize the thing?"

Sorry! There are no comments related to the filter you selected.

I've always seen good (1)

Phalnix (714052) | more than 10 years ago | (#8653544)

results when using fixed swap size. as far as a dedicated controller and drive for swap.... that i dont know.

Erm (2, Funny)

Anonymous Coward | more than 10 years ago | (#8653549)

Swap file? Modern operating systems use a page file. Get out of your Loonix mind set, hippie.

Re:Erm (-1, Flamebait)

Qwaniton (166432) | more than 10 years ago | (#8653857)

GNU/Linux uses swap partitions, dumbfuck.

Re:Erm (1)

NanoGator (522640) | more than 10 years ago | (#8654641)

"GNU/Linux uses swap partitions, dumbfuck."

Mod parent up!! (So we can laugh at him!)

Re:Erm (0)

Anonymous Coward | more than 10 years ago | (#8654578)

Swap is to page is to ... ?

The flaw in your argument... (1)

leonbrooks (8043) | more than 10 years ago | (#8654765)

...is that MS Windows is not a modern operating system. It got a shot in the arm as a reincarnated MICA (VMS 5+) but Microsoft managed to hobble even that.

Swap partitions are even faster, but MS Windows can't do those.

swapping? (3, Interesting)

ArmorFiend (151674) | more than 10 years ago | (#8653553)

Do people still swap? Seriously, I can't remember when I heard my prime dueller do the rumble, and its only got 512 megs of ram.

Re:swapping? (1)

Anonymous Coward | more than 10 years ago | (#8653560)

Surely you've used one of the Mozilla brood? Even with 2 Gigs of RAM, the beast is wont to swap.

Re:swapping? (1)

ArmorFiend (151674) | more than 10 years ago | (#8653579)

I do use Moz, and I don't notice any swapping. Maybe my HD is to quiet AND my gnome swap meter is broken?

Re:swapping? (3, Informative)

Hythlodaeus (411441) | more than 10 years ago | (#8653585)

As is often the case, games are making some of the greatest demands on hardware. Many current games fill 300 or more MB by themselves, and right now I'm sitting on 225 MB with Mozilla, Word, and mIRC open.

Re:swapping? (1)

M1FCJ (586251) | more than 10 years ago | (#8653953)

if you start working on Java development and if you have quite a lot of files to compile... Welcome to the world of blinking disk lights...

Re:swapping? (5, Funny)

ColaMan (37550) | more than 10 years ago | (#8654119)

Close Word and you'll probably gain 100MB :-)
No, seriously.
I don't know what the hell kinda easter egg's in Word - I know Excel had a flight sim , maybe Word's got a 5 minute video of BillG rolling naked in a pile of money and whores.

Re:swapping? (1, Funny)

Anonymous Coward | more than 10 years ago | (#8654695)

I don't know what the hell kinda easter egg's in Word - I know Excel had a flight sim , maybe Word's got a 5 minute video of BillG rolling naked in a pile of money and whores.
Nah, that was me.

Re:swapping? (1)

Enrico Pulatzo (536675) | more than 10 years ago | (#8653587)

I'd say that you don't do anything worthwhile with that computer, then...but hey, that's just me.

Re:swapping? (1)

BCoates (512464) | more than 10 years ago | (#8653635)

Even if you have enough ram to function without swap space, you should enable it and give it some room so that the OS can swap out as it sees fit to make room for a bigger disk cache.

Re:swapping? (0)

Anonymous Coward | more than 10 years ago | (#8653644)

Seriously, I can't remember when I heard my prime dueller do the rumble, and its only got 512 megs of ram.
Well, then. I see you haven't tried this [freenetproject.org] yet ;)

Re:swapping? (1)

batemanm (534197) | more than 10 years ago | (#8654321)

Up until 2 days ago my office PC was swapping loads, then again it was a PIII 800 with 256 meg of memory. It was leading to performance problems. My new P4 2.8Ghz with a gig of ram doesn't seem to have the same issues :-) Now I'm just trying to get top to report that it is 0% idle, used to happen a lot on the old machine.

Yes this post was just an excuse to tell people that I have a new computer :-)

Fixed size... (4, Interesting)

Motherfucking Shit (636021) | more than 10 years ago | (#8653571)

The general advice that I've picked up is that, at least in the *n?x world, you should create a swap partition which is double the size of the machine's physical RAM. For example, if you're sitting on 512MB of RAM, a 1GB swap partition is appropriate.

You only mention Windows towards the end of your question so I can't tell whether or not you're looking for a Windows answer. I've always allowed Windows to resize its swap file, but within a small window. This machine (Win2K) has 640 megs of physical RAM, and the swap file is set at 1280 minimum, 1960 maximum; that gives Windows "double the real RAM," but not a license to take over the whole drive. Seems to work well for me.

I've never tried putting the swap on its own channel or controller - or even on its own drive - under any OS. Like you, I'd be interested in hearing whether or not this is worth the trouble.

If security is a concern (1, Informative)

Anonymous Coward | more than 10 years ago | (#8653680)

If security is a concern, set Windows to use a fixed swap size, i.e. the minumum and maximum values should be identical. Then, install Eraser [heidi.ie] (GPL), which offers the ability to wipe the swap file during the reboot process.

Re:If security is a concern (1)

EddWo (180780) | more than 10 years ago | (#8654177)

Windows can do that itself anyway.

http://support.microsoft.com/support/kb/articles /q 182/0/86.asp

Or you can do it with a GUI. Control Panel -> Administrative Tools -> Local Security Policy -> Local Policies -> Security Options -> Shutdown: Clear Virtual Memory Page File -> Enabled

Re:Fixed size... (3, Informative)

zatz (37585) | more than 10 years ago | (#8653705)

I think the recommendation of "at least twice physical memory" makes sense only with a VM system which employs a one-to-one mapping between allocated pages and disk blocks. I do not believe either Linux or Windows works this way.

Re:Fixed size... (2, Informative)

Brandybuck (704397) | more than 10 years ago | (#8653754)

I've never tried putting the swap on its own channel or controller - or even on its own drive - under any OS. Like you, I'd be interested in hearing whether or not this is worth the trouble.

I still do this, but with 1G of RAM, I never swap anymore. Back back when I had a 100MHz system and 32M RAM, putting the swap on another harddrive made a significant difference. That was with Linux. Since Windows uses a swap file instead of a raw partition, so it might not make much of a difference.

Acting (0)

Anonymous Coward | more than 10 years ago | (#8656836)

Why should I care what an actor says about anything other than acting?
In fact, acting is nothing more that being paid to express someone else's ideas. So why should I believe they're sincere in this particular instance, and not shills for someone else?

Re:Fixed size... (3, Informative)

WSSA (27914) | more than 10 years ago | (#8653889)

Don't let Windows resize the swapfile - that's a surefire path to fragmentation, fragmentation = slowness.

Re:Fixed size... (1)

Motherfucking Shit (636021) | more than 10 years ago | (#8654325)

Well, I can't disagree with that. However, I would imagine that the OP and anyone savvy enough to be similarly curious is probably the type who runs chkdsk /r and defragments fairly often. At least I do ;)

Re:Fixed size... (1)

FlyingOrca (747207) | more than 10 years ago | (#8655571)

Absolutely. Fixed size at twice the amount of RAM, on a separate disk if possible. It's worked for me since NT4 (through 2K, XP, and server 2003). It's the resizing that really thrashes your disk anyway. Cheers

1

Re:Fixed size... (1)

larien (5608) | more than 10 years ago | (#8654468)

2*physical RAM is an old rule of thumb which falls over on large systems; we have one server with 16GB of RAM and we don't really want to allocate 32GB of swap space which should never be used as a rule.

In most cases, servers should never swap; most systems these days only have swap as a space for crash dumps; both Solaris and Windows do this.

Also, as others have said, leave Windows page files at a constant side to avoid fragmentation; this is one thing which the *nix world has definately got right.

Re:Fixed size... (1)

unixbob (523657) | more than 10 years ago | (#8654509)

That was valid in the old BSD days, but newer paging algorythms no longer need this.

Dedicated (2, Informative)

yosemite (6592) | more than 10 years ago | (#8653575)

It is better

Windows? (0)

Anonymous Coward | more than 10 years ago | (#8653582)

You had me interested until you mentioned that this was for Windows. Yuck.

Re:Windows? (0)

Anonymous Coward | more than 10 years ago | (#8653631)

Have you considered autoerotic asphyxiation?

Re:Windows? (0)

Anonymous Coward | more than 10 years ago | (#8653672)

No thanks, I'm living proof that even Lunix geeks can have girlfriends...

Yes, seperate drive and fixed size (5, Interesting)

viware (680138) | more than 10 years ago | (#8653591)

My experience has always been to give windows a fixed page file, at twice the RAM size (ie. 512MB RAM so 1024MB page file). Further, a separate physical drive is the best scenario, or second best is a separate partition.

It is important to note that WindowsXP will use the page file whether you've got plenty of RAM or not.

Re:Yes, seperate drive and fixed size (1)

Dibblah (645750) | more than 10 years ago | (#8654315)

"Second place a seperate partition"

Eh? You like making the head traverse the platter to get to your swap partition... why? Don't do this - Please.

Re:Yes, seperate drive and fixed size (1)

jantheman (113125) | more than 10 years ago | (#8654358)

I've always (when a separate HD was not available) put the swap file in it's own partition - ideally in the phyical middle if you think it's going to be used alot - ever since I had a real bad experience with OS/2 swap mechanism smiting every sector of the partition it was in - right from sector 0 onwards.

Ok, so I don't use it any more, & it's probably fixed now (yes - it really did do it), but stuff like that gets burnt into your psyche.

Re:Yes, seperate drive and fixed size (1)

kayen_telva (676872) | more than 10 years ago | (#8655097)

I've never understood the reasoning behind "I have more ram, so I make a bigger swap file".

Seems counterintuitive. Does anyone know why this is ??

Re:Yes, seperate drive and fixed size (2, Informative)

Zeriel (670422) | more than 10 years ago | (#8656125)

Well, back in the good old days when 4MB was "more RAM", you generally only had a machine with relatively large amounts of RAM if you were processing a similarly large amount of data.

Joe User would have a machine with 4MB RAM and 8MB swap for his word processing and Ultima 2 or whatever.

Stan Scientific would have a machine with 32MB RAM and 64MB swap because he probably was going to eventually have to deal with datasets larger than 32MB (if you've done ANY scientific computing over historical datasets, you know what I mean).

Basically, more RAM implies you should be swapping less, for a home system.
But for a server or high-end processing computer, more RAM implies you need vast amounts of RAM in general, and swap doesn't hurt.

Re:Yes, seperate drive and fixed size (4, Informative)

Quarters (18322) | more than 10 years ago | (#8655548)

It is important to note that WindowsXP will use the page file whether you've got plenty of RAM or not.

You can instruct XP (and probably 2K) to not page the executive and to use more memory as cache space. This reduces the amount of paging significantly.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Session Manager\Memory Management
*Change DisablePagingExecutive to 1
*Change LargeSystemCache to 1
*Reboot

Re:Yes, seperate drive and fixed size (3, Informative)

JeFurry (75785) | more than 10 years ago | (#8657024)

You can instruct XP (and probably 2K) to not page the executive and to use more memory as cache space. This reduces the amount of paging significantly.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Session Manager\Memory Management
*Change DisablePagingExecutive to 1
*Change LargeSystemCache to 1
*Reboot

True, but doing this disables standby and hibernate modes, since the kernel can't be unloaded any more. If that's not a problem for you, go ahead of course, but it's worth being aware. I did this, and kept finding my system going into standby on request, but never resuming, and it took me ages to find out why...

Separate swap under linux. (4, Informative)

derrith (600195) | more than 10 years ago | (#8653592)

I've done this under linux, say get a 2-6GB drive and use it as dedicated swap. I tend to do this with scsi servers when I'm patching together old gear. Say an 18GB root drive and then the smaller drive as dedicated swap. leaves everything open. And if the swap drive does get thrashed, no big deal. It's quite effective and works well in my experience.

Dedicated is better; linux lets you RAID it (2, Informative)

Anonymous Coward | more than 10 years ago | (#8653593)

Dedicated is better.

However, you will never get true swap performance using Windows.

To do that you need a real operating system. Linux will let you put one swap partition on each controller, set them to the same priority, and it will automatically spread the access between them, getting a RAID-like speedup in your swap access times.

Also, remember to put swap partitions (if you are using files you are hopelessly fucked) on the end of the disk, so that they will be on the outer sectors where the transfer rate is fastest.

Re:Dedicated is better; linux lets you RAID it (-1, Troll)

Anonymous Coward | more than 10 years ago | (#8653647)

See, the problem is that the submitter likely doesn't want to spend any extra money. When you add the $699 licensing fee for SCO/Linux your suggestion doesn't seem worth it. Plus, he probably wouldn't agree with becoming a cocksmoking teabagger.

Re:Dedicated is better; linux lets you RAID it (0)

Anonymous Coward | more than 10 years ago | (#8653648)

How did "swap" and "performance" wind up in the same sentence and not be antonyms?

Where I'm from, if you are hitting your swap file with any kind of frequency, it's time to take a hard look at adding RAM.

Re:Dedicated is better; linux lets you RAID it (0)

Anonymous Coward | more than 10 years ago | (#8653669)

Windows supports spreading swap over devices since at least Win2K. Linux is great, but grow up, yeah?

Re:Dedicated is better; linux lets you RAID it (1)

spiff42 (718678) | more than 10 years ago | (#8654155)

Also, remember to put swap partitions (if you are using files you are hopelessly fucked) on the end of the disk, so that they will be on the outer sectors where the transfer rate is fastest.

I have always thought that the sectors were numbered from the outside inwards. I remember this from some comments regarding dual-boot, and how having Windows on the first partition and Linux on the 2nd would make the Windows system a little faster and the Linux system slower (compared to Linux on the 1st partition and Windows on the 2nd).

Does anyone have any hard facts on this question. ie. will it be better to have the partition you want most performance from at the beginning or the end of the disk? Are there any filesystems that use the space from the other end (as in higher sector numbers)?

In regards to setting the priority on the swap partitions, this works very well. When I setup software RAID systems with linux, I always have a partition on each disk for swap. Depending on the needed stability I will let the swap-system handle the striping (with priority), or mirror the swap (if we need to be able to survive a disk crash without rebooting).

Coming back to the original post, I am wondering if Windows supports swapping to a partition? Wouldn't there always be some overhead in swapping to a file (eg. having a filesystem layer in between)?

/Spiff

Re:Dedicated is better; linux lets you RAID it (1)

ivan256 (17499) | more than 10 years ago | (#8656927)

Does anyone have any hard facts on this question. ie. will it be better to have the partition you want most performance from at the beginning or the end of the disk?

It depends on the disk manufacturer. It's fairly easy to tell though. Modern disks have track zones, with a different number of sectors per track in each zone. The length of a track increases towards the outside of the disk, so the zone with the most sectors per track is the outside of the disk. On scsi disks you can get the zone data with the scsiinfo utility under linux.

Re:Dedicated is better; linux lets you RAID it (1)

Prowl (554277) | more than 10 years ago | (#8654260)

but putting them in the middle of the disk will on average reduce the seek time.

Re:Dedicated is better; linux lets you RAID it (1)

MarcQuadra (129430) | more than 10 years ago | (#8654805)

only if your files are spread evenly throughout the entire disk. I know most of MY disks are only using 2-3 GB of the 40-80 available.

The exception is the 'storage' drive on the server, and that's only holding files, not serving as a swapper or system volume.

I've had the best luck in 2.6 with using a swapfile instead of a partition, and making the swapfile with 'dd' and 'mkswap' after the base system is installed and before I lay down all the other stuff. That places the swapfile close to the most-used application files and towards the outer end of the disk. I use a 512MB swapfile on all of my machines, most have 512-1024MB RAM and since I've been doing things this way I've only ever used about 3MB of swap (linux pages out unused stuff after a while).

2.6 has a system whereby it can use a swapfile just as efficiently as a separate partition (it bypasses the filesystem layer to access it?).

Re:Dedicated is better; linux lets you RAID it (1)

Micro$will (592938) | more than 10 years ago | (#8656466)

That places the swapfile close to the most-used application files and towards the outer end of the disk.

How do you know? One of the features of ext2/3 is the way it avoids fragmentation by randomly placing files all over the partition, unlike FAT16/32 which fills the partition from start to end.

The only way to optimize the location of swap space in Linux is to use a dedicated swap drive, or place the swap partition between /boot and /.

Linux Swap Space Mini-HOWTO (3, Informative)

sICE (92132) | more than 10 years ago | (#8653632)

This [ibiblio.org] Linux Mini-HOWTO might be of interrested to some /.ers, it describes how to share your Linux swap partition with Windows.

Re:Linux Swap Space Mini-HOWTO (1, Informative)

Anonymous Coward | more than 10 years ago | (#8654316)

Caution advised if you want to do this and use Software Suspend [slashdot.org] on Linux. (i.e make sure it's not your swsusp swap space that's going to get overwritten if you suspend Linux and boot into Windows).

Good Results (3, Interesting)

harryk (17509) | more than 10 years ago | (#8653636)

I too am in a similar environment as yourself. I took it one step further, and also setup the temp variables to use the same drive.

I've noticed significant performance increases since doing, not to mention that I've freed up some space on other, more important drives.

Good luck!

Swap: Don't boot XP without it (3, Interesting)

WarPresident (754535) | more than 10 years ago | (#8653653)

An old, surplus, dedicated swap drive on its own channel: $0.00

A RAMdrive from system memory: Under $100 [cenatek.com]

A solid state disk drive you shove into a PCI slot with a bunch of SDRAM on it: Priceless [cenatek.com]

For everything else, there's, Hey! Why would I pay more than a grand for a PCI bandwidth capped solid state drive when I can fill my memory slots and use RAMDrive at DDR bandwidth?

Re:Swap: Don't boot XP without it (1)

Hast (24833) | more than 10 years ago | (#8653899)

Even Windows has a built in RAM disk, although you have to define it in the boot files. So changing the size requires a reboot unfortunately.

Re:Swap: Don't boot XP without it (1)

WarPresident (754535) | more than 10 years ago | (#8654288)

Even Windows has a built in RAM disk, although you have to define it in the boot files. So changing the size requires a reboot unfortunately.

You mean the DOS driver ramdrive.sys? That isn't installed by default (does it exist anymore?) in XP. If I remember correctly, wasn't there a 256MB limit anyway? Perhaps not an issue if you've got 3GB of real RAM...

Re:Swap: Don't boot XP without it (0)

Anonymous Coward | more than 10 years ago | (#8654338)

Yep, it still exists [microsoft.com] .

Putting swap in a RAM disk makes no sense (4, Informative)

mlq (236146) | more than 10 years ago | (#8654344)

Putting swap in a RAM disk makes no sense what-so-ever.

Re:Putting swap in a RAM disk makes no sense (2, Informative)

Strange Ranger (454494) | more than 10 years ago | (#8656887)

Parent is not informative. Provocative maybe. In order to be informative, the parent's statement needs a supporting explanation, including what OS.

RAM disks are fast, Windows requires swap no matter your physical RAM size, so why not put it on a RAM disk?

What are us dummies missing mlq? Please elaborate.

Re:Swap: Don't boot XP without it (1)

NanoGator (522640) | more than 10 years ago | (#8654698)

"A solid state disk drive you shove into a PCI slot with a bunch of SDRAM on it: Priceless"

I went into sticker shock when I saw the 1-gig RocketDrive PCI card was $1,000. But then I got to thinking about it: It would cost me $500 to go from 1 gig of RAM to 2. (I have to throw out the old RAM...) Assuming it behaves better than my hard drive (well it should.. I mean it won't be as fast as the main memory but it should kick the drive's butt...) I could set the swap drive to it and get much better performance while I'm rendering. Then, if I get a new machine where I max out the RAM, I can slap the card in and still have an extra gig.... Yeah, I see what you mean by 'priceless'.

Sorry to babble. I'm sitting here waiting for my computer to render. It's swapping about 500 megs in. Ugh.

Re:Swap: Don't boot XP without it (1)

Marillion (33728) | more than 10 years ago | (#8655085)

Also note that it has a built-in controller. The key benefit is that it's not limited to the slowness of the channel connector - IDE/SCSI/Fibre - whatever.

no sense in that (3, Insightful)

zatz (37585) | more than 10 years ago | (#8653656)

First, if this is a workstation for one person, not an application server, then you are not likely to feel performance is acceptable when paging does happen, regardless of the device where swap resides. Just because your OS installer insists that you allocate swap space doesn't mean you should use it often.

Second, transfer rates have increased about ten-fold since that drive was manufactured. (Access times haven't.) While it is ideal to have swap space on its own spindle and controller, it doesn't make much sense to optimize details like that but use such a slow disk.

Just make a swap file on your system disk and forget about it. If the rest of the machine is new, it should have enough physical memory that swap is mostly irrelevant.

Pls Mod Parent Up! Re:no sense in that (1)

Kevster (102318) | more than 10 years ago | (#8657201)

Why do so many people keep saying "twice the physical RAM?" Can anyone really provide technical justification for it? Sure, it's not like we're generally hurting to set up a 1 GB paging file on a 120 GB drive, but as far as I can tell it's futile.

Having a paging file does not increase performance! How can it? It's there to let programs allocate more 'memory' than physically exists in the machine, but if you're doing that regularly performance will suck. Badly. The more of the paging file is used, the more time you spend waiting for data to be read from the disk (slow) instead of RAM (fast). This is not the stuff of good interactive response!

If you must, create a huge paging file, run your favourite programs for a few days without restarting the machine, and see how much of the paging file was actually used. Then reduce your paging file to that size, plus a margin for error. That's enough.

Absolutely!!!! (3, Informative)

OC_Wanderer (729511) | more than 10 years ago | (#8653661)

From Windows XP back to Windows 95, gurus have suggested a fixed size of 2 or 2.5 times the size of your RAM. I keep it at 3 times, because I have CRS disease and can't remember the exact size. Better safe than sorry, since I have the room.

Swapping on a separate drive is faster than swapping on the same drive. I've tested that. I also put the "temp" directories on the separate drive, as well as the data directories for my applications. This includeds the mailbox for Outlook Express and the temporary internet files for Internet Explorer.

There's a big bonus to setting up like this, besides performance. There's less to backup from C: drive!

[Contrary to popular belief, not all nerds and geeks use OSS.]

Re:Absolutely!!!! (1)

zatz (37585) | more than 10 years ago | (#8653673)

There's a big bonus to setting up like this, besides performance. There's less to backup from C: drive!

This is an attempt at humor, right?

Re:Absolutely!!!! (1)

slashdot_commentator (444053) | more than 10 years ago | (#8654139)

This is an attempt at humor, right?

Depends. Do users skip pagefile.sys when backing up? If so, yes.

Re:Absolutely!!!! (0)

Anonymous Coward | more than 10 years ago | (#8654128)

[Contrary to popular belief, not all nerds and geeks use OSS.]

Ah yes, I know your type well. "I don't program, its too much trouble to install/use linux, but I use _________. I MUST be an ubergeek/ubernerd." *cough* luser *cough*

two drives and 1 controller, with striped swap. (2, Informative)

Elivs (43960) | more than 10 years ago | (#8653666)

I have two ide drives and 512M ram. I have the first 512M on each drive as a swap with linux stripping the swap. (See "man 2 swapon", "man swapon", "man 5 fstab" and set the priorities of each partion to be the same) I did this on the assupmtion that the bottleneck is likely to be disks's read/write speed, not the controller.


Like you I'm also not sure if it makes much difference but my system certainly seems to often be swap limited. I currently have KDE3, several gnome apps, a browsers with 4 windows (20+tabs), 2 virtual desktops, and I often use octave to process high resolution images. Changing from one app to another can cause the machine to swap for a few seconds if I've haven't used the first app in a few hours/days.


Elivs


Clearly if I used windows I wouldn't have these problems as I could never leave apps idle for days while doing another task.

/me Ducks as an "MS wireless mouse" flies towards me...

Re:two drives and 1 controller, with striped swap. (1)

Glonoinha (587375) | more than 10 years ago | (#8656712)

Controller limitations on IDE drive subsystems mean one read/write process at a time - thus putting half your swapfile on one drive and half on the other really don't gain you anything on an IDE system.

If you had one drive on one controller, the other drive on a different controller (or if you were using SCSI) and you will see gains.

That said, if your system seems swap limited watch the memory utilization - if your system has 512M and it is using all 512M of it, add more RAM for better performance (disclaimer - I have no clue whether or not your OS will use more than 512M but if it does, go for it.)

Good news in you are looking at going to Windows - starting with Windows 2003 they are 'seeing crazy uptime numbers now, like three months' [microsoft.com] .

The HD sounds like a good idea (5, Insightful)

PurpleFloyd (149812) | more than 10 years ago | (#8653679)

As far as using the HD goes, it sounds like a good idea, albiet with some conditions:
  • If you're planning on spending any money on this, it would be better off going towards more RAM.
  • If the drive isn't as fast as your primary HD, it may not be as good a deal as you might think. Remember that the non-DMA access modes used by older IDE drives, can eat up your CPU and thus any performance gain. Of course, this isn't an issue with SCSI if that's what you're using.
  • If you use an app that has its own scratchpad requirements, you might want to put that on the drive rather than your Windows swapfile. Photoshop comes to mind immediately as an example of where this would be a good thing; it might also be good for dumping processed video onto (although if you're doing major video work, you should have a fast, preferably RAID-0, scratchspace, along with more reliable storage).
As far as a fixed-size swapfile, it should help some in Windows; when you defrag, it will help to keep your swapfile coherent as much as possible. Of course, if the swapfile is the only thing on the drive, it won't matter too much. If you do go for a fixed size file, make sure to make it larger than you ever think you'll need - it sucks to run out of memory when you're doing a lengthy, complex operation. One rule of thumb (not as valid these days) is to set your swap to 2x your physical memory. Another, which I use, is to simply take the most memory you'll ever think you'll use and then add a 50% safety factor. Remember to resize this if you ever start working with really large stuff - high-res video, 3000 x 3000 pixel Photoshop images, etc.

Finally, remember that idealy, you never want to hit swap at all. If you're experiencing problems with thrashing, you should probably either pare down your system (do you really need to run that IM program all the time? all those systray utilities you never use?) or simply bite the bullet and get more RAM. Even the fastest hard drive can't touch RAM for speed, and seeing your system hit the pagefile for routine tasks means it's time to put a new stick of RAM into the beast.

Worry about what causes thrashing... (1)

briaydemir (207637) | more than 10 years ago | (#8653685)

Another thing to consider: why is your machine thrashing? If what you're working with can't fit in RAM, then that's likely your real problem, not how efficiently you implement a swap file/partition. Compared to RAM, hard drive access is glacially slow, regardless of how you set things up.

Most operating systems today should be able to deal with swap files/partitions with reasonable performance, without you having to go to great lengths to optimize things. So probably the "default setup" (whatever that may be) will be fine, unless you really need that last ounce of performance.

Not enough data. (1)

Phexro (9814) | more than 10 years ago | (#8653693)

You don't specify how much RAM your system has, nor how much you actually use your swap space.

If you really hit your swap hard, then I guess installing a dedicated swap drive would make sense. Of course, so would upgrading your RAM, which would have a much more positive impact on your system's performance, and without the additional heat, noise, and power consumption that adding another drive would.

As another poster mentioned, the rule of thumb is to have twice as much swap as physical ram. Personally, I think that's outmoded, and I don't see the point in even having a swap partition equal in size to a system's physical ram. I have 512mb in my desktop box, and I rarely hit my swap. Right now, I'm running a slew of apps, and I've only hit 5mb of swap.

In short, it may be an interesting exercise, but it's probably not worth it.

Some tips on optimization (1, Funny)

Anonymous Coward | more than 10 years ago | (#8653695)

Generally according to the "Microsoft" way of doing things, you always want to seperate your system partition and your swap file. Hence if your OS is installed on your C: drive (be it the RAID array or your ATA drive) you should put the swap file on the other drive (d: or what have you). But in your case , I would be more tempted to put a smaller swap file (say about 2-300 MB on the raid partition, whichever that is) and make sure it is limited. Try it out for a while and if your programs are claiming they are running out of memory, switch to a larger or non-limited swap file.

I'm generally not attracted to men, but my God something about Hitler just drives me absolutely batty! That dramatic sweep of hair across his brow, like he just tossed his head and there it fell, a cascade of black like the velvet curtain of night. I want him to take me on the hood of a King Tiger, its 1400 horsepower engine revving as he violates the virginal secrets of my Eagle's Nest. I picture it like those glorious mass rallies the Nazis used to have. There he is lovingly pounding away at my second front while legions of goose-stepping Aryans march past and salute our union. Just as Hitler is about to empty his tiny ubermenschen into the expanse of my Liebe-raum a wing of Stukas will fly overhead, their sirens howling in synchronicity with the primal cries of pleasure from Der Fuehrer. My god, what a man!

Basically what I'm saying is if your RAID partition does not host your operating system it is very recommendable to put a swap file there as there will be less activity from the OS and swap file conflicting with each other, resulting in faster performance and paging.

BTW have you tried running with out a swap file?

Great troll. (0)

Anonymous Coward | more than 10 years ago | (#8653845)

Man, that was a good troll. Short, but sweet.

Re:Some tips on optimization (0, Offtopic)

imag0 (605684) | more than 10 years ago | (#8654015)

First troll I've laughed out loud at in a very long time. Good job!

You had me... (-1, Redundant)

Anonymous Coward | more than 10 years ago | (#8653723)

...right until you said "Windows".

Of *course* it's worth it! (1)

Eneff (96967) | more than 10 years ago | (#8653730)

Because not only will you get to play with antiquated technology, (yeah... 2GB is antiquated now.) but you get not one but two slashdot articles out of it!

Just remember, you have all your time to avoid the slashdot effect, so you better have mirrors, boy. There ain't no excuse!

In a word. Yes. (0)

Anonymous Coward | more than 10 years ago | (#8653751)

Duh. This is classic old school system architecture. Better yet - place your swap file on a separate striped array on your 2nd PCI bus. So there.

Yes. (1)

skinfitz (564041) | more than 10 years ago | (#8653905)

Does it make sense to install the 2GB drive on its own controller and use it for a dedicated, fixed swap file?

Yes.

Some suggest that... (0)

AndyElf (23331) | more than 10 years ago | (#8654020)

... you need a separate swap partition for each drive you've got, not for the whole system. This maybe, however, a bit of BSDism -- that's the land I've been living in lately.

Also, has "128Mb swap limit" been surpassed in Lunix-land? Will you really be able to use whole 2Gb as a single partition or you'd have to split it up, ugh, 16 ways?

Lastly -- on my BSD boxes even with X and mozilla running swap usage would tend to be minimal, unless I am doing something really big on top of that (like running KDE with a bunch of apps together with a buildworld or a portupgrade -rRf x11/kde3)

Re:Some suggest that... (1)

richie2000 (159732) | more than 10 years ago | (#8654272)

Also, has "128Mb swap limit" been surpassed in Lunix-land?

Yes.

Re:Some suggest that... (0, Troll)

10Ghz (453478) | more than 10 years ago | (#8654453)

Also, has "128Mb swap limit" been surpassed in Lunix-land?


Is it just me, or are the *BSD-guys generally speaking assholes who suffer from somekind of superiority-complex towards Linux-users?

To answer your question: Yes it has been surpassed. in 1998! [iu.edu] So you are only about 6 years behind the times!

Re:Some suggest that... (1)

GiMP (10923) | more than 10 years ago | (#8655988)

There is no need to have a separate swap partition per disk; however, some operating systems (Linux and FreeBSD) can do raid-like striping across the swap partitions for additional performance.

Best Optimisation (-1, Flamebait)

Anonymous Coward | more than 10 years ago | (#8654111)

The single best optimisation you can make on your system is to delete Windows and install a proper operating system that has been designed and implemented by competent software engineers.

However, yes, having it on a dedicated drive on its own controller will help immensely.

If your machine is swapping that much that it noticeably slows down in regular use, you should consider installing more RAM. My humble Slackware box at home has 512MB RAM and rarely, if ever, has to wait for stuff to get swapped back in, because of Lunux's clever caching algorithms, and the fact that I don't run anything bigger than a web browser. Yes, nowadays a web browser is probably the most bloated, resource-hungry piece of code you'll ever run. In days of yore it was compilers, then word processors....

Re:Best Optimisation (0)

Anonymous Coward | more than 10 years ago | (#8654356)

The single best optimisation you can make on your system is to delete Windows and install a proper operating system that has been designed and implemented by competent software engineers.

You're suggesting Dave Cutler [microsoft.com] isn't competent?

Re:Best Optimisation (0)

Anonymous Coward | more than 10 years ago | (#8654379)

No, but he's wearing the Lead Boots of Bill Gates. They've slowed him down a bit.

Multiple swap partitions on multiple drives (1)

Kopretinka (97408) | more than 10 years ago | (#8654121)

Just my 2c: I used to own a machine with limited RAM but with two HDDs. I split swap on dedicated partitions on both drives with the same priority (in Linux, I don't know if Windows can do this) and when I needed to swap, the performance increase was huge.

One Word Answer: No (5, Informative)

silverfuck (743326) | more than 10 years ago | (#8654123)

Okay, so this is too late for all but the most sad of slashdotters to read it, but here goes:

If the drive is 2GB, then don't be so sure that it is fast - it may have been when it was bought, but that was 6 or so years ago at least. I would be very suprised indeed to see more than 4-5MB/s sustained read and 2-3 write; there have been a lot of advances in the last few years.

My current setup (1GB physical RAM) has 2GB set aside for each of Win2k and Linux in seperate partitions right in the middle (this will speed up average access times as the heads will have the least far to travel on average from any random point over the platters) of the raid array (and hench middle of both disks, as it is RAID-0), which I know to be fast - benchmarking has pegged it at greater than 110MB/s sustained. Windows will hit the swapfile no matter what (just try setting the swap to 0, even on a well-heeled system, and watch it complain at bootup/logon), so it gets 512MB to play with just at bootup and can go all the way to the end of it's swap partition if it wants. Linux, well, that's another story (currently support for the raid array is patchy, so not running linux - the partitions are still there, though, waiting for filsystems!), but as everybody knows, linux is very aggressive about swapping stuff out and using physical RAM as a disk cache, so again I expect it to hit the swapfile after a few days (hours?) running, but be perfectly happy with 2GB.

Windows Swap (0)

turgid (580780) | more than 10 years ago | (#8654132)

The last time I set up Windows on my Pee Cee (1996 IIRC) it would swap stuff out to disk because of 64k segment limitations. I think it was when it had too many icons, or the colour depth was too great. You used to have to install the DOS disk cache program to try to cache the stuff in high memory that Windows insisted on swapping out to disk, even though the system maybe had 16 or 32 megabytes of RAM. I find it hard to believe they haven't fixed this yet. Maybe they have? Is that why the speed of your swap partition is so critical?

Performance considerations (2, Informative)

jcasey (264935) | more than 10 years ago | (#8654323)

If thrashing is causing degradation, I would seriously consider increasing RAM before improving on the swap drive.

Check the performance specs for that 2gig drive first. If you are connecting an older, slower drive, you may actually worsen performance. For best performance, use a drive that can supports whatever performance features your mobo offers ( UDMA-66, Serial ATA, etc... )

IF using Windows 2000/XP you can spread your page file accross multiple hard drives.

Yes, definitely (2, Insightful)

BoogieChile (517082) | more than 10 years ago | (#8654626)

I've always gone for the extra channels when I'm buying a motherboard. Windows and apps live on one drive, swap/temp files and data on the other.

Real world experience - Rally Championship 2000 - swap file on the same drive as the game - loading times were long - 30 seconds or more. The indicator bar would move for a bit, stop for a bit, move for a bit, stop for a bit...

Change the swap file to the other drive and the level loading time went away. 18 seconds.

And the progress indicator keeps moving all the way with no pauses.

Think of it as the difference between having to do everything one handed (read this bit off the drive, track all the way across the platter to the swap file, write that bit there, track all the way back across the platter for the nexct bit of reading, etc, etc, etc), and having two hands (read with the right, write with the left)

What I've always heard.. (1)

MImeKillEr (445828) | more than 10 years ago | (#8654824)

..is to put the swap on a drive other than the OS (not just a different partition), and on a different channel. I've also heard to put the swap start/stop at the same size (so its not fighting the filesystem for space) and to have the size be 2.5 to 3 times the amount of physical RAM installed.

If you're running Windows NT/2000/XP, make the partition in question NTFS too.

I'm running XP Pro with 512MB of PC2100 and have my swap start/stop at 2GB (ok, 4x my RAM) on an NTFS partition. The little trashing I do have is because that partition also contains game files and downloads from bittorrent.

I imagine if you're using a 2GB drive solely for swap and nothing else, you may not have any thrashing at all.

How reliable is that 2GB drive though? I guess it doesn't really matter, cause if the drive fails, the OS should move the swapfile back to the default location.

do nothing (1)

phrasebook (740834) | more than 10 years ago | (#8654837)

I've got a pretty standard computer with reasonably fast drives.

So you don't need to do anything. Leave it alone. You're not going to notice an ounce of difference. All you'll be getting is the extra noise and heat of another hard drive, which will be rarely, if ever, be getting accessed. No need to do it.

may not boot if drive disconnected (0)

Anonymous Coward | more than 10 years ago | (#8655086)

> If it is better to have a dedicated swap file on its own controller?

I had this setup a few years ago on a machine with 128 MB of RAM. It was definitely faster.

One tip: if the paging file is on a separate disk, Windows may not be able to boot if that drive is disconnected. The solution is to also keep a small paging file on the boot disk, just in case. I recommend testing it by disconnecting the second drive and seeing if it still boots.

swap file page file potato potahto (1)

Oshkoshjohn (537394) | more than 10 years ago | (#8655300)

I created a six-Gig partion on my second internal hard drive for this problem.

Solution: 4GB RAM :-) (0)

AmiMoJo (196126) | more than 10 years ago | (#8655543)

Most versions of Windows support a maximum of 4GB address space, so if you have 4GB of RAM you can't also have a swap file! Zero paging is achived!

I guess the same goes for most other systems out there. Add enough cheap RAM and you are away.

The obvious solution (1, Informative)

Anonymous Coward | more than 10 years ago | (#8655896)

Putting more ram in the machine instead of adding another power consuming hard drive will give you a much better performance boost.

There's no pat answer... (2, Insightful)

pointbeing (701902) | more than 10 years ago | (#8655905)

Apparently we're dealing with Windows, so I'll chime in ;-)

Depends on your PC and what you do with it. Putting the swapfile on the outside edge of the fastest disk that does *not* have Windows on it is generally the best idea. If you're concerned about dissimilar PIO or UDMA transfer rates, if your IDE controller supports multiple media transfer rates (most IDE controllers built after about 1998 do) you don't have anything to worry about. There's no reason I can think of to have multiple pagefiles on a Windows machine unless it's a server or you're heavily into A/V.

Re size of the paging file: A static swapfile is always going to perform better than a dynamic one - provided the static file is big enough. Here's whatcha do -

Use Performance Monitor to measure swapfile use over a week or two. You'll be able to tell exactly how much paging file you need from that. Take a couple hundred MB onto that number just for grins and make it a static pagefile.

Paging to disk is always slower than using real memory - but some applications (one of them being Internet Explorer) *require* a swapfile. My XP box is a dual processor 1GHz machine with 384mb of memory. It's usually just used for surfing the web and a bit of word processing, but I've never seen more than about 10% of its 768mb static pagefile in use.

Hope this helps -

Memory (0)

Anonymous Coward | more than 10 years ago | (#8656617)

I've seen several comments here that basically assert that people are running their computers with 512 MB or even 256 MB of RAM and not swapping.

I don't know how they do it.

I work for a newspaper. I have a Power Mac G5 on my desk with a gigabyte of RAM in it. I run Mail, Safari, iChat, InDesign, InCopy, Photoshop, Illustrator, Suitcase, Acrobat, and Distiller all the time, and my machine swaps constantly. (Okay, I guess keeping iTunes going in the background doesn't exactly help, but how can you work without music? That's like trying to work in the dark, or without a chair.)

G5 RAM (DDR 400, in other words) is getting pretty cheap. I may plop down a couple hundred dollars of my own money to add another gig to my machine. God knows I could use it.

If it's more of a worry than (1)

UnrefinedLayman (185512) | more than 10 years ago | (#8656706)

...the electricity that you'll spend over the years on having this extra hard drive that does essentially nothing, yet remains spinning at all times because it's always being accessed, then yeah, go for it.

Otherwise, forget about it and realize that the cumulative extra two seconds you spend each day because your primary drives are so bogged down by accessing your swap partition are worth not only the money you save by not wasting electricity but also worth making the world that much nicer by not creating an energy drain.

Why must it use soo much swap (0)

BhAaD (692949) | more than 10 years ago | (#8656930)

Im talking about Windows. Regardless of the amount of RAM you have on your system, it will still use your page file. Also, if you try disabling the pagefile and restart the OS, it will automatically create a page file on 'C:' or wherever you installed it. Linux barely touches my swap even with X running and 5 - 10 GUI progs open (512MB RAM). Windows however refuses to leave the damn page file alone Currently im running a total of 33 processes on WinXP (on all visual disabled) and its using 202MB of swap, and 300MB out of 512MB of RAM is still available....Ridiculous
Load More Comments
Slashdot Login

Need an Account?

Forgot your password?