Swap File Optimizations? 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?"
Erm (Score:2, Funny)
The flaw in your argument... (Score:2)
Swap partitions are even faster, but MS Windows can't do those.
Re:Erm (Score:2)
Mod parent up!! (So we can laugh at him!)
swapping? (Score:4, Interesting)
Re:swapping? (Score:4, Informative)
Re:swapping? (Score:2)
Re:swapping? (Score:5, Funny)
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? (Score:2)
Bill's horse pic in win95. From which we
can reliably conclude that he prefers horse
to whores, although the statement is
misleading in some ways.
re: Easter eggs (Score:2)
So assuming there were something as large as a 100 MB Easter egg, it wouldn't take
Re: Easter eggs (Score:2)
Re:swapping? (Score:2)
Re:swapping? (Score:2)
Re:swapping? (Score:2)
Re:swapping? (Score:2)
Yes this post was just an excuse to tell people that I have a new computer :-)
Re:swapping? (Score:2)
Yes, swap is still important to many people, even those with 512MB of RAM or more. With a dozen xterms, Mozilla, OpenOffice, etc. open, starting something like a MCAD application makes swap very very useful (if the OS is efficient about it, that is). Using swap doesn't necessarily mean slow performance, if the OS does a one-time dump of unused pages to the disk allowing the one big app to take what it needs. Switching among several large apps, though, means a purchase order for more RAM is in order.
Re:swapping? (Score:2, Interesting)
> got 512 megs of ram.
I make it a point to have enough RAM that the system almost never has to use
the swap space, but I consider it vital to have the swap space there as a
safety net, because occasionally something uses a whole lot of RAM (e.g., I
might write a quick-and-dirty use-once-and-throw-away Perl script to process
some data, and it might store them in a Really Big Hash while doing so, or I
might have to work with an imag
Re:swapping? (Score:2)
Fixed size... (Score:5, Interesting)
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.
Re:Fixed size... (Score:3, Informative)
Re:Fixed size... (Score:3, Informative)
Re:Fixed size... (Score:2)
And a real question: what do you do when you subsequently add more RAM?
Re:Fixed size... (Score:3, Informative)
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.
Re:Fixed size... (Score:3, Informative)
Re:Fixed size... (Score:2)
Re:Fixed size... (Score:2)
1
Re:Fixed size... (Score:2)
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... (Score:2)
Re:Fixed size... (Score:2)
I'm not flaming or trolling, I'm serious. Even if running a GUI (which never happened in the days of 16Meg machines, and don't mention X Windows because I know for a fact the serious number cruning workstations didn't waste their precious RAM on X -- remember, we're talking "back in the day" here) even i
Re:Fixed size... (Score:2)
Re:Fixed size... (Score:2)
Re:Fixed size... (Score:2)
Before vmware (Win98 session, with 164MB of Ram alloc:)
free
total used free shared buffers cached
Mem: 516196 232612 283584 0 24876 85448
-/+ buffers/cache: 122288 393908
Swap: 771040 0 771040
--Same machine, with vmware session running (no programs active in the VM yet, just OS)
free
total
Re:Fixed size... (Score:2)
--But notice - even with all that running at once, you're still using much less than 256MB of swap. You could probably resize that 1GB down to half that, or even 300MB - and still have plenty of leeway. If you're using KDE, I'd consider switching to a more lightweight WM (I use Sawfish, but that's prolly too bare-bone
Re:Fixed size... (Score:2)
The only problem with this (which doesn't make much sense in my mind) and as a caveat, I would say for "modern OSs", why would you need to double the amount of swap for more RAM you put in the system? You'd think that you would need to use a decreasing amount of swap with the more memory you put in your system?
The only thing I could possible figure out, is that if ALL your RAM dumps all of its memory to the swap at once; but again, what OS does this, I'm quite sure that Linux (modern) doesn't do this, a
Re:Fixed size... (Score:2)
I've always found storing Swap/pagefi
Re:Fixed size... (Score:2)
--Example: 900MHz AMD Duron, 512MB RAM
swapon -s
Filename Type Size Used Priority
free
total used free shared buffers cached
Mem: 516196 232612 283584 0 24876 85448
-/+ buffers/cache: 122288
Re:If security is a concern (Score:2)
http://support.microsoft.com/support/kb/article
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
Dedicated (Score:2, Informative)
Yes, seperate drive and fixed size (Score:5, Interesting)
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 (Score:2)
Seems counterintuitive. Does anyone know why this is ??
Re:Yes, seperate drive and fixed size (Score:2, Informative)
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, yo
Re:Yes, seperate drive and fixed size (Score:2)
The other reason is that you have some recurring processes(scheduled tasks, crons, disk defrags) that run at times when the machine is supposed to be idle, but may just be busy. With larger swap, you avoid a crash, by risking more swapin/swapouts.
Re:Yes, seperate drive and fixed size (Score:5, Informative)
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 (Score:3, Informative)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contr o 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 t
Separate swap under linux. (Score:4, Informative)
Dedicated is better; linux lets you RAID it (Score:2, Informative)
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
Re:Dedicated is better; linux lets you RAID it (Score:2)
Re:Dedicated is better; linux lets you RAID it (Score:2)
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 ap
Re:Dedicated is better; linux lets you RAID it (Score:2)
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
Advocating the swapfile instead of swap partitions (Score:2)
Even with multiple drives, running swap and '/' on the fast one
Re:Dedicated is better; linux lets you RAID it (Score:2)
So will Windows (NT, 2k, XP).
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.
Putting them in the middle of the disk
Re:Dedicated is better; linux lets you RAID it (Score:2)
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
Linux Swap Space Mini-HOWTO (Score:4, Informative)
Good Results (Score:3, Interesting)
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 (Score:3, Interesting)
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?
Putting swap in a RAM disk makes no sense (Score:4, Informative)
Re:Putting swap in a RAM disk makes no sense (Score:3, Informative)
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:Putting swap in a RAM disk makes no sense (Score:2)
Re:Putting swap in a RAM disk makes no sense (Score:2)
That's the whole crux of my original post. You ever try that? I already understand everything you're saying and it falls severely short of the truth on a windows box.
No matter how much main memory your system boasts, Windows XP still creates and uses a page file for virtual memory... If you have a large amount of RAM (at least 1 GB), you might think that Windows XP would never need virtual memory, so that it wou [microsoft.com]
Re:Putting swap in a RAM disk makes no sense (Score:2)
But it won't work properly. Windows will try to swap out the ramdisk onto itself. In the end all that will happen is that the swap file will be full of many copies of itself. Better to have a swapfile on disk that is rarely used. I would surprised if Windows will even let you set the swapfile to be on a ram disk.
Re:Putting swap in a RAM disk makes no sense (Score:2)
Because it's a waste. The more RAM you have, the less swap you need.
Re:Putting swap in a RAM disk makes no sense (Score:2)
>it only uses the swap space actively if you run out of RAM.
Should be true. Isn't though. Just watch the Perf Mon.
[time passes...]
Ok, I just spent an hour reading/googling up on this. Apparently the MS link I give above is highly disputed. XP has an option for no-page-file, but MS says it'll make one anyway. But people who have done this can only find the evidence in the Perf monitor. No file anywhere. The mess doesn't stop there.
Apparently there is much hull
Re:Swap: Don't boot XP without it (Score:2)
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 perfor
Re:Swap: Don't boot XP without it (Score:2)
Re:Swap: Don't boot XP without it (Score:2)
LK
no sense in that (Score:3, Insightful)
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.
Absolutely!!!! (Score:3, Informative)
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!!!! (Score:2)
For Solaris 8 and 9, at least,
Re:Absolutely!!!! (Score:2)
That advice goes back to the days of Win 3.1, probably even further back, and it's bullshit. Any "guru" who makes such a blanked suggestion is talking out of his ass. He read it once ten years ago and is just parroting it.
The point of having so much RAM is so that you don't need as much virtual memory. I have 512 MB in my current machine, it would be idiocy to use 1.25 GB of my HD for swap that I
Re:Absolutely!!!! (Score:2)
This is an attempt at humor, right?
Depends. Do users skip pagefile.sys when backing up? If so, yes.
two drives and 1 controller, with striped swap. (Score:2, Informative)
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+
Re:two drives and 1 controller, with striped swap. (Score:2)
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 (disc
The HD sounds like a good idea (Score:5, Insightful)
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.
Re:The HD sounds like a good idea (Score:2)
good god I am fu@#ed... I'm about to start working on 3000 x 3000 res video..... any sugeestions on what kinda system i should buy to do the editing?
Not enough data. (Score:2)
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
Of *course* it's worth it! (Score:2)
Just remember, you have all your time to avoid the slashdot effect, so you better have mirrors, boy. There ain't no excuse!
Yes. (Score:2)
Yes.
Multiple swap partitions on multiple drives (Score:2)
One Word Answer: No (Score:5, Informative)
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.
Performance considerations (Score:2, Informative)
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 (Score:2, Insightful)
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
Re:Yes, definitely (Score:2)
The last time I had a game use swap was Warcraft III on a 256-meg machine, and saw slowdowns like the one you mentioned. Rather than put swap on another drive, I stuck another DIMM in the machine, and the problem was solved. : )
steve
What I've always heard.. (Score:2)
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
Re:What I've always heard.. (Score:2)
Why? NTFS is slower than FAT, offsetting the gains you might have made by your other tweaks. If you're worried about someone being able to read what's on the partition easily, well, they still can if it's NTFS.
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.
If the drive fails, you've just experienced roughly t
Re:What I've always heard.. (Score:2)
Slower how? In accessing files? This is just for the pagefile. And NTFS is better as far as fragmentation goes - less fragmentation with NTFS than FAT or FAT32.
do nothing (Score:2)
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.
There's no pat answer... (Score:2, Insightful)
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
change the partition type, too. (Score:2)
but if you're dealing with xp, you can also gain some speed by NOT using ntfs on that drive. instead, use fat32- your swap file is not a file that needs full ntfs (permission or security or compression or encryption) complexity.
combine that with a fixed size, from the word go, and you can get very nice speed bumps.
If you gotta (Score:2)
Re:Some suggest that... (Score:2)
Yes.
Re:Some suggest that... (Score:2)
Re:Some suggest that... (Score:2)
Kinda like SCO assuming IBM had to buy all them 2.4 goodness...
Gotta remember they have vested interest in linux not being as good as it can be, makes them look good.
Re:If it's more of a worry than (Score:2)
He will use $7.55 of electricity for an entire year. I don't think that will break him.
Re:If it's more of a worry than (Score:2)
Re:If it's more of a worry than (Score:2)
And you sound like a green idiot.
If you want to reduce power consumption, you start with the big things--refrigerators, driers, air conditioners, stoves. You don't start with a 10 W hard drive.
Re:If it's more of a worry than (Score:2)
If you had bothered to read what I said, you would have noticed that I specifically pointed out that people aren't willing to do "big" things, like give up their refrigerators, washing machines and air conditioners.
It's like I said, it's easier to get a dollar from a hundred people than a hundred dollars from one person. It's easier to get ten
Re:If it's more of a worry than (Score:2)
Re:Fast Access (Score:2)
(Now if you were using a redundant form of RAID, that's a different story. No operating system likes having the swap pulled out from under it, so keeping it alive through a disk failure is a good thing.)
steve
Re:Fast Access (Score:2)
Swap is a necessary evil, optimizing it is in everyone's interest.
Re:Fast Access (Score:2)
Remembering, of course, that RAID will actually make your random seek times *worse* (or, best/rarest case, no better), probably offsetting that increase in throughput.
Re:Windows Swap (Score:2)
If you're talking about Windows 9x, then early and excessive swapping had another cause.
The memory manager for Windows 9x tries to take the same philosophy as Unix - use all available memory for disk cache, and release it as necessary. The only problem was that it would not release it willingly enough.
If you watch the memory, swap, and cache usage, you'd see that it would use so much for disk cache that swapping would occur early. Theoretically, that swapped out data could also be in the disk ca