Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



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 @09: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.
    • The GP implied (e.g.: "inexplicably still working") they're using older hardware; therefore, I'd imagine that PCI-E isn't being used on his system. AGP is possible; but, from the tone of the article, I'm leaning more toward his system using PCI.

      What would be the bottlenecks if he was using PCI video RAM?
      • by LSD-OBS ( 183415 )
        The bottleneck is always the bus on the card itself, between the VRAM and the PCI/AGP/whatever bus. For some reason they're never designed for decent transfer speeds in that direction, which has been the downfall of many good ideas in the past (not to mention a lot of 2D graphics algorithms)
      • by omeomi ( 675045 )
        He did state that he's using the "built-in video adapter", which I would imagine is on-board, and thus neither PCI, AGP, or PCI-E.
        • by Andy Dodd ( 701 ) <atd7@@@cornell...edu> on Thursday October 11, 2007 @10: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.
        • Re: (Score:3, Informative)

          by ckaminski ( 82854 )
          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.
          • However (Score:2, Informative)

            by Sycraft-fu ( 314770 )
            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.
            • 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.


              No, nearly all CURRENT built-in adapters use system memory. In the past (think pentium/pentium II era) most on-board graphics adapters used dedicated vram soldered to the motherboard. The OP said that it was older hardware - it's reasonable to assume that it is separate memory rather than assume he is using system memory.
        • Well if that is the case, then he's using system memory anyway... So, the bottleneck is that it's going from ram, out, and then back in to the ram to be tested.
    • Re: (Score:3, Insightful)

      by arth1 ( 260657 )
      It shouldn't matter, cause AGP is in no circumstance slower than the 33 MHz PCI bus, and you can run a couple of IDE hard drives maxed out on a PCI ATA controller.
    • Is your adapter an AGP or PCI-Express card?

      using the Video RAM of the built-in video adapter as a swap device
      The adapter in question is built into the motherboard.
      • Re: (Score:2, Informative)

        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.
      • Onboard video still uses the same bus structure as available for expansion (believe I saw 1 board with all PCI slots & an ISA onboard video but it was fucked from the get go). Most of the chipsets will simply load the data on the bus & be done with it - the BIOS cuts out the onboard at POST when another video card is detected. A few of the boards seem to route through the onboard in a serial rather than true bus fashion(greatly reduced framerates on boards with the same video card & similar chip
        • by sumdumass ( 711423 ) on Thursday October 11, 2007 @10: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.
          • by dpilot ( 134227 )
            For that matter, if this is Unified (el-cheapo) Memory Architecture, and you've got "video memory" that you're not using, take a look in the BIOS and see if there's some way to dedicate less system memory for video. Giving the memory back to the system would be far better than trying to use it through the video subsystem.
      • What would be even funnier is if it were one of those cards that uses "shared" system memory for video memory.
      • Built in adapters have no ram of their own and proprietary connections to the internals of the chipset.. this is bunk. This might be interesting on a PCI-E Geforce with 256MB of DDR3 though.
        • by abradsn ( 542213 )
          Never say never. There are sometimes, especially with old machines that the board does have some video memory on it. It's usually a very small amount of memory though (if it is there at all).
    • I question whether hdparm really gives him a number that is valid for a comparison against any kind of physical RAM.

      Certainly the actual swap performance would be greatly affected by where the swap file is on the disk, and what else the disk is used for. If the disk is being called on to do other things at the same time the swap performance would take a huge hit. Then there's the matter of just how often he needs to use the swap, and how much is needed. If the system simply is over-taxed and has too litt
  • by default luser ( 529332 ) on Thursday October 11, 2007 @09: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).
    • by gfxguy ( 98788 )
      If it's really that aging it might still even be PCI or, if it's really old, ISA.

      It's hard to imagine a PCIe card being slower.
    • AGP is basically a souped-up single-drop PCI slot. AGP is fundamentally capable of doing full-speed in any mix of Read-Write as long as the target device is capable of sustaining the operation. The problem is that most GPUs have been designed as output-only devices and their host controller interfaces, be it PCI, AGP or PCIe, have been designed for fast writes to video memory but only implemented a low-cost, small-footprint, low-performance readback path since it is superfluous for normal operation. If you
  • size (Score:4, Informative)

    by TheSHAD0W ( 258774 ) on Thursday October 11, 2007 @09: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.
    • Re:size (Score:5, Informative)

      by arivanov ( 12034 ) on Thursday October 11, 2007 @10: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.
      • Welllll... What's better? A big RAM disk in an uncached portion of main memory, or a small RAM disk on a video card - also uncached?
    • Re: (Score:3, Informative)

      by arth1 ( 260657 )
      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.

      Howeve
    • by sootman ( 158191 )
      Maybe it uses an integrated video chipset that shares the main memory. D'oh!

      In that case, the best advice would be "Go into the BIOS and dial it down to 1MB." :-)
  • by redelm ( 54142 ) on Thursday October 11, 2007 @09:43AM (#20939913) Homepage
    This is certainly a clever idea for small amounts of swap (~256 MB). But to make it work well, you'd have to find the GPU commands for block moves from main RAM to vidRAM. That's the only way to activate the AGPx2 and higher modes.

    But there is a fundamental problem: vidRAM is optimized for writes from main RAM. Not reads. In many cases, reading vidram is extremely slow because the raster generator is busy reading it. Writes are buffered. Reads cannot be.

    • by rbanffy ( 584143 )
      There could be a way to turn off the raster generator and then increase the reading speed a bit. However I doubt any video board designer ever considered such a corner case.

      But, given the story that the machine is a server running an e-commerce website that, presumably, should be up most of the time, I would suggest buying a cheap entry level server from Dell with enough memory and just forgetting about it. Running a server on luck generally indicates someone will have to deal with an emergency migration on
  • by bostons1337 ( 1025584 ) on Thursday October 11, 2007 @09:44AM (#20939923)
    This doesn't sound like the most stable thing to do especially if your running a server on the same computer. It sounds good on paper but implementing it is a whole different game. From my years in IT never try anything like this on production servers, thats what test servers are for.
    • Eh... if you're running production servers, spend a few bucks and buy adequate RAM and disks.

      This is more an exercise for novelty/home enthusiasts.
  • by arivanov ( 12034 ) on Thursday October 11, 2007 @09: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...).
  • video RAM (Score:5, Insightful)

    by mcmonkey ( 96054 ) on Thursday October 11, 2007 @09:58AM (#20940145) Homepage
    Are you sure the system has video RAM? Doesn't built-in video generally share the system RAM?

    • I was wondering the same thing. If that is the case, it makes sense that it would be pretty slow - all that you would be doing by making use of the "video RAM" is cannibalizing system RAM, and accessing it in a presumably slower way (since any reads/writes to it would have the extra step of going through the video system, which depending on the age of the system is likely to be relatively slow).
    • Re: (Score:3, Informative)

      by julesh ( 229690 )
      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 jollyreaper ( 513215 ) on Thursday October 11, 2007 @10:01AM (#20940193)
    I know headless means that the system doesn't have a screen but I still get this idea of a box strapped to a horse, chasing down Ichabod Crane.
  • by TeknoHog ( 164938 ) on Thursday October 11, 2007 @10:11AM (#20940347) Homepage Journal

    Heck, I remember RAM expansion cards for ISA slots. I'm sure this is faster, though I didn't get any meaningful boost when I tried this once. Nevertheless, if you're running headless system, it's better IMHO if you get some use of the display hardware, rather than no use. Even if it's a little slow. You shouldn't rely on swap as a memory expansion anyway, it's just a way to gracefully degrade performance when you hit the limit.

    I think it's also nice to have swap on a different physical device/bus from your main hard drive. Maybe the swap isn't any faster, but at least it isn't slowing down any other hard drive usage.

    • 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). For those times, it was a whopping 2 MB of memory. I guess anything beat going to the hard drive in those days. The Borland pascal IDE seemed to be working fine with it, but hell, RAM was *expensive* back then.
  • by Waffle Iron ( 339739 ) on Thursday October 11, 2007 @10:23AM (#20940529)
    Old-fashioned dual-ported VRAM is an excellent solution for an e-commerce site. You can be loading customer transactions and one-click purchases from the VRAMs' random-access ports while you're simultaneously serving web pages from the serial-access ports. Your performance will double!

    Now if you want truly blazing speed, you can track down some of that dual-ported static RAM that came in 40-pin DIPs. Full random access on both ports would let you serve dynamic web pages while you run customer transactions, all with zero wait states on the ISA bus!

  • by Rolman ( 120909 ) on Thursday October 11, 2007 @10:42AM (#20940899)
    It's very cool that the memory becomes available so easily with just a couple driver parameters. It's a pity that there's a lot to optimize before it can really shine.

    Memory architecture on a GPU is very different from system memory. Memory there is not linear and the video memory controller will go through a lot of remapping to present it as such, something that's probably very slow because of the VBIOS. Then there's the issue of tuning the bus so that reads and writes are using its full bandwidth, and again a poor VBIOS implementation may be the bottleneck.

    The best but harder solution would be to have a means to program the video memory controller directly to map pages of system memory and do all the copying and moving itself. Of course, this is hardly ever going to happen, but some improvements can still make it into the VBIOS, some of which will probably happen once GPGPU-style programming starts getting more attention as both nVidia and AMD/ATI are seemingly interested in pushing with things like CUDA [nvidia.com] and Stream Computing [amd.com].

    The concept as it is now, however, remains extremely cool. It might still be orders of magnitude slower in terms of latency and throughput compared to system memory, but it should be a lot more responsive than a hard drive just because there are no seek times involved. That said, hdparm -t may not be the best tool for measuring performance, so i'd be more interested in a random access benchmark since it may make some use of the parallel memory architecture inherent on a video card.
  • Ha! (Score:3, Funny)

    by TheVelvetFlamebait ( 986083 ) on Thursday October 11, 2007 @11:04AM (#20941205) Journal
    And to think people laughed at me when I bought a shiny new 1GB video card!
  • by Zymergy ( 803632 ) *
    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
  • DMA? (Score:3, Informative)

    by OrangeTide ( 124937 ) on Thursday October 11, 2007 @12: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 grommit ( 97148 )

      Your harddrive, even thought it is slow
      I hear ya man. My HDD is pretty emo. It just sits around thinking about how slow it is compared to the other HDDs out there.
  • PS3 VRAM Swap (Score:4, Interesting)

    by Doc Ruby ( 173196 ) on Thursday October 11, 2007 @01:56PM (#20943693) Homepage Journal
    Since the PlayStation 3 has only a small main memory that's hardwired and nonexpandable (Sony's lamest design decision of all), the Linux that runs on it is severely constrained. PS3 Linux is constantly swapping to compensate for the small memory. But the PS3 does have another small VRAM bank (that's extremely fast XDR). PS3 Linux hackers are working on using VRAM as swap, out of necessity. Their design analysis is probably instructive for anyone considering any platform's VRAM as swap.

Put your Nose to the Grindstone! -- Amalgamated Plastic Surgeons and Toolmakers, Ltd.

Working...