Is Video RAM a Good Swap Device?
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 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.
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.
Are you sure the system has video RAM? Doesn't built-in video generally share the system RAM?
No.
It's an interesting hack to use it as such, but in terms of performance you're better off investing in more RAM and a faster HDD.
Video RAM is designed for performance, not for stability. If a bit flips in your video RAM, a pixel is going to be bad or a texture will be slightly different. You're not going to notice.
A bit flip in your swap space (or main RAM), now that is something you really don't want to happen....
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.
Escher was the first MC and Giger invented the HR department.
It will be more than slightly different if one of the most significant bits of any byte is changed in such a way, it may very well be white or black instead of medium gray. Also, VRAM is used for more than just pixel data now. It it also used to store geometry in the form of display lists and executable code for vertex, geometry and pixel shaders. One bit flipped in a floating-point value or in a executable bit of code and it could affect an entire rendered frame.
Although, I can only imagine the senior engineers at companies at Nvidia raising their hands to their head and screaming "Noooooooo!!!!". I guess that happens when you choose to have one storage device have a faster bus transfer rate than all the others.
Vintage computer adverts: http://www.vintageadbrowser.com/computers-and-software-ads
Besides, Slashdotters have never bought the "why are you running if you have nothing to hide" argument.
You know, there is a difference between trolling and pointing out the flaws in your reasoning. Just saying.
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 and Stream Computing.
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.
- Otaku no naka no otaku, otaking da!!!
Problem is, most people who think the whole "swapping is bad" thing are windows users, an OS that still has a tendency to swap out the most interesting and useful things.
:)
Swap is great for a server or workstation, once set on a single task it needs never do anything else till shut down, but for a windows PC that could at any time have anything run on it (not to mention a sub-standard disk cache system) having parts swapped out to make room for a disk cache that doesn't do a whole awful lot is less than optimal.
This is of course the point where you point out that converting all your junk to windows vista and training all your staff to use the new office 2007 "ribbon" is about the same cost as training them to use linux and OOo, the latter being a lot cheaper too
...
Neither of the technologies he listed were PCI. VESA came out in the late 80s/early 90s, as did EISA. to the best of my knowledge EISA was never used on video cards unless it was highly specialized. they went from the VESA local bus, to PCI, to AGP and its various speeds, to PCI-E x16.
I think one of the points of confusion here seems to be that most people don't realize that while something is built into a motherboard it doesn't have some magical interface that makes the bits fly differently than if it was in a slot. I think that is what is attempted to be said by the multiple posts this comment has generated
As a rock-in-roll Physicist once said, No matter where you go, there you are.
I hope so, because that's where I like to keep my swap partition. Actually, that's not necessarily optimal. If you were reading a file on the inner edge and get a page fault, the disk will have to do a full seek all the way to the other side to be able to get the page. You're better off putting the page file halfway between the inner and outer edges to lower the average length of your seeks for page faults. Of course, that depends on how much thrashing you're experiencing and how much file access is mixed in with that, so YMMV
IIRC, NTFS has some of its main data structures in the middle of the partition for that reason.
If it's lower bandwidth and higher latency than the rest of system memory, then it makes perfect sense to NOT use it as primary storage but as a secondary storage. Currently, swap is the only straightforward mechanism Linux offers for doing so.
Program Intellivision!