Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
Data Storage Operating Systems Software Hardware

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?"
This discussion has been archived. No new comments can be posted.

Is Video RAM a Good Swap Device?

Comments Filter:
  • AGP or PCI-Express (Score:5, Informative)

    by j_sp_r ( 656354 ) on Thursday October 11, 2007 @10:40AM (#20939867) Homepage
    Is your adapter an AGP or PCI-Express card? Because PCI-Express has fast lanes both ways, and AGP is not so fast in writing back. That could explain a part of the performance problems.
  • by default luser ( 529332 ) on Thursday October 11, 2007 @10:43AM (#20939897) Journal
    I'm assuming your ancient system uses an AGP interface for graphics, which has a very fast download rate, but very poor upload. The maximum performance of AGP uploading data from the card memory to the rest of the machine is pretty slow (less than 100MB/sec, IIRC), and it will vary depending on the implementation. This is probably the reason you got such slow benches.

    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)

    by TheSHAD0W ( 258774 ) on Thursday October 11, 2007 @10:43AM (#20939909) Homepage
    How much RAM is in your video card? 64 megabytes? 128? If it's an older machine, probably much less than that. Assuming you have less than a gigabyte of main RAM in your system it's probably much more worthwhile to drop a few dollars on expanding that and running whatever RAM disk you need in there.
  • by arivanov ( 12034 ) on Thursday October 11, 2007 @10:55AM (#20940097) Homepage
    Err... Which hdparm timings are you looking at?

    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...).
  • by Corporate Troll ( 537873 ) on Thursday October 11, 2007 @10:57AM (#20940123) Homepage Journal
    Not wanting to burst your bubble but there is a significant difference between good old PCI [wikipedia.org] and PCIe [wikipedia.org].
  • by dougmc ( 70836 ) <dougmc+slashdot@frenzied.us> on Thursday October 11, 2007 @11:00AM (#20940177) Homepage

    ATA 133 (I will assume this, due to the "aging hd mentioned) is only 17MB/sec for comparison's sake.
    No, ATA [wikipedia.org] 133 is theoretically 133 MB/s. It's bytes, not bits.

    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)

    by arivanov ( 12034 ) on Thursday October 11, 2007 @11:05AM (#20940237) Homepage
    Not quite so.

    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)

    by arth1 ( 260657 ) on Thursday October 11, 2007 @11:07AM (#20940279) Homepage Journal
    Expanding the RAM isn't always feasible. I have one dns/dhcp/proxy/smb server with 512 MB RAM, and that's max for the i815P chipset (Tualatin-S CPU). Adding more RAM would mean switching out the motherboard, which would also mean switching out the CPU, and we're up to so much money that it's easier just to add a new server and move everything over. Since the average server load is close to zero and only peaks once a day (when doing compressed backups), there's no point in moving to anything faster.

    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)

    by Corporate Troll ( 537873 ) on Thursday October 11, 2007 @11:08AM (#20940297) Homepage Journal
    Bull... Even onboard video adaptors are connected to via a bus and that bus will be either ISA, VESA Local Bus, PCI, AGP or PCIe, depending on the age of the machine.
  • Re:Just misinformed (Score:5, Informative)

    by arth1 ( 260657 ) on Thursday October 11, 2007 @11:30AM (#20940685) Homepage Journal

    If you can buy enough memory not to have to swap, why would you? Swap is for people who can't afford any more memory, and are willing to take a massive performance hit to avoid said expense.

    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.
  • by edwdig ( 47888 ) on Thursday October 11, 2007 @11:36AM (#20940781)
    What's a high end ISA graphics card going to have, 512 KB of RAM ? I can't picture anyone wanting to swap to that. PCI most likely wouldn't have more than a few MB of RAM, making it questionable as well.
  • Re:video RAM (Score:3, Informative)

    by julesh ( 229690 ) on Thursday October 11, 2007 @11:49AM (#20940981)
    Doesn't built-in video generally share the system RAM?

    Not always. For example, I have a machine that has 32MB of video RAM, and can use additional system RAM if necessary.
  • by ElecCham ( 78742 ) on Thursday October 11, 2007 @11:49AM (#20940987) Homepage
    (ObDisclaimer: I work for Seagate.)

    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.
  • by Andy Dodd ( 701 ) <atd7NO@SPAMcornell.edu> on Thursday October 11, 2007 @11:56AM (#20941083) Homepage
    Whether it is built into the motherboard or is built into the chipset itself, it almost always still has an "internal only" PCI, AGP, or PCI-E interface, and is thus affected by the performance limitations of that interface.
  • by ckaminski ( 82854 ) <slashdot-nospam.darthcoder@com> on Thursday October 11, 2007 @11:58AM (#20941105) Homepage
    Nearly all video adapters made in the past 10 years are either PCI, PCIe or AGP. Whether or not they are add in cards or soldered on the motherboard is irrelevant.
  • by sumdumass ( 711423 ) on Thursday October 11, 2007 @11:58AM (#20941123) Journal
    This sort of brings up another issue he might be happening. A lot of on board video cards use system memory to function properly. If the swap space is actually in system memory, the extra transfer overhear of going up the bus to the controller that then send it back to the memory that is actually sending the stuff to the video ram.. Well, you see what I mean. The extra few steps could be enough latency per read write operation to slow the thing down compared to a direct access method that would be present with an IDE connection as well as video memory built on to the video car itself.

    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)

    by Sycraft-fu ( 314770 ) on Thursday October 11, 2007 @12:20PM (#20941427)
    Built in is relevant since nearly all built in adapters do not have their own RAM. They borrow some of the system's RAM to use. As such using it as swap is dumb, since it is just system RAM. A better solution is to turn down the amount of RAM the onboard card gets to reserve (usually the BIOS can control this). Separate graphics adapters almost always include their own RAM, and as such could potentially be useful.
  • by TeknoHog ( 164938 ) on Thursday October 11, 2007 @01:12PM (#20942139) Homepage Journal

    Oh, a friend of mine had a rather rich father who bought such a thing for a 286. Don't know how they used it exactly, as a RAM drive, swap space or even some sort of main memory (I always thought the latter, but that seems extremely unlikely for a 286).

    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]
  • by Zymergy ( 803632 ) * on Thursday October 11, 2007 @01:16PM (#20942189)
    Like this one: http://techreport.com/articles.x/9312 [techreport.com]
    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)

    by OrangeTide ( 124937 ) on Thursday October 11, 2007 @01:18PM (#20942231) Homepage Journal
    Might be faster if the driver knew about DMA. Your harddrive, even thought it is slow, has DMA. So when you want to swap out pages you can set it and forget it. You're not really in any hurry to swap out, only to swap in. So it seems while a harddrive lets the CPU do other work while it ways for the pages to be copied, the MTD slram driver does not.

    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.
  • by amorsen ( 7485 ) <benny+slashdot@amorsen.dk> on Thursday October 11, 2007 @02:20PM (#20943061)
    So it might be something in the card itself causing the slowdown.

    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.
  • by kelnos ( 564113 ) <[bjt23] [at] [cornell.edu]> on Thursday October 11, 2007 @03:31PM (#20944327) Homepage
    No, it's a headless system -- if VRAM is actually being stored in a chunk of system RAM, the way to go here would be to just disable the VRAM entirely and reclaim it as normal system RAM.
  • by hasdikarlsam ( 414514 ) on Thursday October 11, 2007 @04:51PM (#20945583)
    It's perfectly possible, you just have to use a volume manager like LVM to concatenate the partitions

"And remember: Evil will always prevail, because Good is dumb." -- Spaceballs

Working...