Is Video RAM a Good Swap Device? 235
sean4u writes "I use a 'lucky' (inexplicably still working) headless desktop PC to serve pages for a low-volume e-commerce site. I came across a gentoo-wiki.com page and this linuxnews.pl page that suggested the interesting possibility of using the Video RAM of the built-in video adapter as a swap device or RAM disk. The instructions worked a treat, but I'm curious as to how good a substitute this can be for swap space on disk. In my (amateurish) test, hdparm -t tells me the Video RAM block device is 3 times slower than the aging disk I currently use. If you've used this technique, what performance do you get? Is the poor performance report from hdparm a feature of the hardware, or the Memory Technology Device driver? What do you use to measure swap performance?"
AGP or PCI-Express (Score:5, Informative)
Probably a good idea, provided you have PCIe (Score:5, Informative)
PCIe will likely give you performance more in-line with main memory (most implementations now are hitting 1-2 GB/s).
size (Score:4, Informative)
Are you looking at the right timings? (Score:5, Informative)
One of the biggest advantages of using VRAM for disks is the nearly 0 seek latency.
As a result even if the card is slower than disk on read you are still likely to have an overall performance gain.
In addition to that there is a number of architectural vagaries to consider. AGP is asymmetric. Reading is considerably slower than writing (can't find anywhere by how much. Damn...).
Re:AGP or PCI-Express (Score:1, Informative)
Re:Probably a good idea, provided you have PCIe (Score:5, Informative)
And I used to regularly get sustained 25-30 MB/s from single drives (40 GB or so) on ATA 33 interfaces. Going to ATA 66, 100 or 133 may increase the speed when hitting the on-drive cache, but the drives themselves usually can't go that fast. How fast are the fastest IDE drives nowadays for sustained, sequential transfers -- 50 MB/s or so?
Re:size (Score:5, Informative)
If it is really old it may be running one one of the early Intel Pentium Triton chipsets. The TX will not cache any memory above 64 and the HX needs to be reconfigured to cache above 64. Even after reconfiguration it will just about work for 512MB. There are other similar vagaries related to most old hardware. Ali depending on release and version tanks at 384 or 768 and so on. Even chipsets as recent as Intel 815e while capable of 2G were deliberately bastardised to support only 512MB in order not to undercut the inexistent market for high-end Rambus/i810 based workstations.
So there are quite a few cases where it is more cost effective to use an old and long past its hayday high end video card as a swap device. All the way up to around 2001-2002. From there onwards nearly everything supported sane memory sizes so it is pointless.
Re:size (Score:3, Informative)
However, more RAM would mean being able to increase the squid cache, which now is limited to 24 GB, due to RAM, not disk space.
Regards,
--
*Art
Re:I'd Say...Neither (Score:2, Informative)
Re:Just misinformed (Score:5, Informative)
Bzzt - wrong.
Even high-end systems use swap space, because it allows for swapping out parts of memory that isn't called, freeing up that memory for things like disk cache, which does have a positive effect.
Doing "free" on a system here, I see that there's 886492 kB of free memory, of which 879896 kB is used for disk cache. 72892 kB is swapped to disk, and if there were no swap, the disk cache would have been that much smaller. Even if I had umpteen gigabytes of RAM free, that still would be 70 MB of extra cache by using a swap partition. That's a Good Thing.
What's a Bad Thing is when swap is used because you run low on memory -- then you get trashing and a seriously slow system. But on a healthy system with enough free memory, where the kernel can swap out pages not because it has to, but because it makes sense, using swap is a Good Thing.
Re:AGP or PCI-Express (Score:3, Informative)
Re:video RAM (Score:3, Informative)
Not always. For example, I have a machine that has 32MB of video RAM, and can use additional system RAM if necessary.
Re:Probably a good idea, provided you have PCIe (Score:5, Informative)
On a current-model 7200RPM SATA drive, you can expect to see around 80MB/sec at the outer edge of the disk. And the rule of thumb is, you see half that at the inner edge, and three-quarters in the middle. So call it a (nearly) guaranteed 40MB/sec, and an average of 60MB/sec.
These are not hard-and-fast numbers, but it's a pretty good estimate for a modern drive.
Re:AGP or PCI-Express (Score:5, Informative)
Re:AGP or PCI-Express (Score:3, Informative)
Re:Built in still uses the bus.... (Score:5, Informative)
I think the differences might be as noticeable as turning DMA (direct memory access) on and off. And yes, you can see a big bit of difference. It was actually worth me buying new drives just to have DMA access when it first started becoming available. I remember earlier versions of windows 98 and (95 I think), that wouldn't turn it on by default. After making sure the drives supported it and enabling it, people would almost think they had a new computer. There was that much of a difference in performance.
However (Score:2, Informative)
Re:Useful even if not so fast (Score:3, Informative)
It was main memory, but back then we had the XMS/EMS hack instead of flat memory.
http://en.wikipedia.org/wiki/Expanded_Memory_Specification#Expansion_boards [wikipedia.org]Use a SATA Ramdisk... (Score:2, Informative)
It works wonderfully for Windows swap file! (and better still for Photoshop/Premiere swapfile) It is limited to 4GB (draws power from the PCI bus) and it is driver-less. (works with ANY PC motherboard supported OS)
It connects to the PC using a SATA1 connection (but a continuous 1.5 Gb/s is still better than most HDDs) and it uses 4x 1024MB DDR1 RAM Modules.
There is a future 8GB DDR2 SATA2 3.0 Gb/s model (allegedly) coming out soon that fits in a 5.25" drive bay:
http://techreport.com/discussions.x/10116 [techreport.com] (please, oh please, don't be vaporware)
DMA? (Score:3, Informative)
There isn't enough memory on a videocard to really make it worth doing the right way either. Mine only has 256M which is not that big compared to systems that have 1G to 2G of system RAM and 1-4G of swap.
Re:AGP or PCI-Express (Score:3, Informative)
The PCI bus and its derivatives (AGP, PCI-X, PCI-Express) is basically send-only. If you try to fetch across it, things can't burst properly, and access is very slow. Most PCI and AGP graphics cards don't have proper DMA engines for sending, so the CPU has to fetch. Many PCI-Express graphics cards can be told to do DMA.
Re:AGP or PCI-Express (Score:3, Informative)
Re:Probably a good idea, provided you have PCIe (Score:2, Informative)