Virtual Memory and SSD

11

1

While studying for the A+ Exam I was reading about SSD's and I thought to myself that if you had a mobo with a low RAM limit you could use a dedicated SSD purely for Virtual RAM. I looked up some info on line and the info I found said that this was a poor practice but didn't explain why. Why shouldn't SSD's be used for Virtual Memory and what are your thoughts on a dedicated Virtual Memory drive? Thank you!

Zombian

Posted 2011-11-14T18:46:08.413

Reputation: 441

@Breakthrough But when you disable virtual memory, programs are killed randomly when the system runs out of memory, resulting in data loss. Virtual memory is for preventing this. – endolith – 2015-03-27T14:04:49.420

@endolith I didn't say to disable the page/swapfile. It should just be placed on another disk if possible - preferably a spinning, mechanical HDD, as they don't have a finite number of write cycles (unlike flash-based solid state drives, where using it for virtual memory would accelerate the wear on the drive). – Breakthrough – 2015-03-28T06:27:29.983

1If you can afford a SSD, I doubt your motherboard has a low RAM limit. RAM is cheaper and faster then a solid-state drive, and SSDs should NEVER be used for virtual memory!!! They have a limited number of writes, and using them for virtual memory often will severely reduce the lifespan of the drive. (Yes, I agree that they're faster then using a HDD for virtual memory, but if you're paging out even to a SSD, you're still paging out 10-20 times slower then RAM...). – Breakthrough – 2011-11-16T12:58:59.600

1I believe he's using "virtual memory" in this context to mean "RAM drive". – Bigbio2002 – 2011-11-17T16:53:56.593

2Should I keep my swap file on an SSD drive? – Sathyajith Bhat – 2011-11-28T11:39:07.183

Answers

8

While people are suggesting you do not put a page file on SSD there is nothing to stop you, there are also similar-ish ideas such as Microsoft's Readyboost, though it uses a USB stick instead of an SSD. It works in a vaguely similar fashion (caching hard disk reads instead of caching virtual memory - but the theory of the method of performance boost and flaws are the same) but has very similar reasons for limitations as putting a page file on an SSD:

  1. Flash based memory has much poorer write tolerance than spinning-platter or full-on memory chips. Typical flash devices these days are getting as low as 5,000 write cycles for a standard MLC device, with the manufacturers using wear-levelling algorithms to help the device last longer. Sadly it seems that many SSDs fail after 1-2 years (see here for some failure rates during the first year), but this is typically due to failure of the SSD's hardware or firmware, rather than wear of the flash memory.

  2. USB sticks are dirt cheap, come in all the major helpful sizes (4GB, 8GB, 16GB and so on) and for small reads and writes are pretty comparable to an SSD. They suck at bulk transfers though.

There is also Intel's latest Smart Response which is effectively another version of the ReadyBoost technology.

So as long as you don't mind the idea that you could potentially wear the SSD out faster (though no faster than putting the entire OS on the SSD to be honest) then there is no reason not to put your page file on the SSD as it should perform better than the hard disk.

Mokubai

Posted 2011-11-14T18:46:08.413

Reputation: 64 434

4What he's suggesting is not like Readyboost at all. Readyboost uses flash as a disk cache, to accelerate disk I/O under normal conditions. He's talking about using flash as a paging file, to accelerate paging (which only matters under abnormal conditions when the system is paging). At least, that's how I understand his term "virtual RAM". – David Schwartz – 2011-11-14T19:20:18.837

1While Readyboost is not exactly what was being asked for it achieves very similar ends by using a flash device to service reads and writes that would otherwise go to a slower device. It is the closest we have to SSD as a pagefile device and my other points about why-not-to-do-it are still valid. – Mokubai – 2011-11-14T19:30:53.637

2How is it the closest we have to using SSD as a pagefile device when you can actually use SSD as a pagefile device (simply by placing a pagefile on a filesystem on the SSD)? – David Schwartz – 2011-11-14T21:12:24.587

1Any reliable references for claiming "Sadly it seems they don't and many SSD users are finding that their super new devices wear out after 1-2 years"? – Ƭᴇcʜιᴇ007 – 2011-11-14T22:06:23.287

5

@techie007 Yep, our very own Jeff Attwood: The Hot/Crazy Solid State Drive Scale

– Mokubai – 2011-11-14T22:08:53.070

@DavidSchwartz I've amended my answer away from where you seem to be arguing as you seemed to miss the actual point I was trying to make that there are other technologies that use similar ideas to the page file (which caches memory while others cache files) and that they are all at the mercy of hardware that has built in failure... /out – Mokubai – 2011-11-14T22:11:58.647

2

@Mokubai: That's not wear level. That's just plain old failures. Tom's Hardware did a similar article explaining how SSDs are no more reliable than a mechanical harddrive over its lifetime. But there isn't evidence to say that the lifetime is 1-2 years. http://www.tomshardware.com/reviews/ssd-reliability-failure-rate,2923-9.html

– surfasb – 2011-11-15T00:26:16.390

@surfasb that's because it's your job as the end user to determine how long your drive will last, since nobody can predict your usage patterns. The fact of the matter is SSD cells have a maximum write capability of somewhere around 10,000 writes, and there are calculations you can do to predict when the drive will no longer be useable. Most people who buy SSDs are power users, so you can expect the lifespan of those to decrease (as in Atwood's post). – Breakthrough – 2011-11-16T13:04:07.827

2@Breakthrough: It is also the job of the linker to read the article. Notice when I posted my comment, it was before someone else edited the answer to include "but this is typically due to failure of the SSD's hardware or firmware, rather than wear of the flash memory." – surfasb – 2011-11-17T04:18:05.243

3@Mokubai I completely, 100% disagree with your entire answer. What ReadyBoost does is nothing whatsoever like putting a page file on a flash device, the theory of the method of performance boost is completely different (one uses the flash as a disk cache to accelerate random reads under normal conditions, the other uses flash as a page file to reduce the performance penalty of low-memory conditions). There is no reason to expect one to be anything at all like the other. – David Schwartz – 2011-11-28T05:30:52.233

1-1 for naming USB, SSD and comparable speed in one sentence. – inf – 2012-01-20T06:35:08.077

11

I am using a 60GB SSD as a dedicated virtual memory drive running on windows 7 it is SATA-3 and I'm getting speeds of 450MB sec.

My machine is fully loaded with 32GB memory in all available slots. I'm using this machine to edit feature length movies in HD so this memory is quickly eaten up.

I have to say that the SSD virtual memory drive is a great help in reducing the bottleneck when memory runs low and VM kicks in. I don't care if the drive dies in a year or two, I'll just replace it with another cheap drive.

scott thomas

Posted 2011-11-14T18:46:08.413

Reputation: 111

4

SSDs are slower than RAM, but faster than HDDs. So, the obvious place for an SSD to fit into virtual memory is as swap space (swap partion in Linux; page file in Windows). The operating system automatically uses the swap space as needed when RAM is in short supply, so by putting swap on the SSD, you get faster-than-HDD performance when swap is needed.

On Windows the page file normally lives at C:\pagefile.sys, so to put that on SSD you'd have to either put your C: drive on SSD, or somehow tell Windows to put the page file elsewhere.

The other method that you seem to be suggesting is to somehow make the SSD look like additional RAM to the OS. I don't know how you would do that, but I agree that it would be a bad idea, since SSDs (flash memory) are slower than RAM.

Andrew Schulman

Posted 2011-11-14T18:46:08.413

Reputation: 2 696

This is what it boils down to. While SSDs are fast compared to traditional HDs, RAM is significantly faster. While SSDs latencies are measured in milliseconds, DRAM has latencies in nanoseconds, and systems have bandwidth measured in several GB/sec, compared to several hundred MB/sec for SATA. – afrazier – 2011-11-14T20:02:41.167

1

SSD as virtual memory (swap/paging file) my be the best solution for those computers who don't allow memory upgrades. For instance, I own an Asus netbook, whose ram memory is soldered on the motherboard, so no memory upgrade is possible.

According to Asus local support line, the netbook model I own, does not allow any kind of upgrade, not even a new ssd drive. I suspected this information was wrong, may be for commercial reasons, so I went ahead with the replacement. It worked as expected, and the general performance boost was incredible. I installed one of the latest generation ssd drives with writing speed of 450 Gb/s and reading speed of 550 Mb/s.

Martins Almeida

Posted 2011-11-14T18:46:08.413

Reputation: 11

1

Since RAM is currently cheap and SSD's are horrendously expensive, it doesn't make sense. You can buy 12G of RAM for something like $80. That would be the same dollar amount as a SSD and granted the SSD is larger, but, it eats an SATA port, adds heat, takes more power than RAM. If you have enough RAM, you normally won't be swapping so much to the virtual memory. Most of the SSD wouldn't be used anyway. Only about 3Gig would normally be used. For 4Gig of RAM, the price would be even cheaper.

Blackbeagle

Posted 2011-11-14T18:46:08.413

Reputation: 6 424

My notebook has 2 RAM slots. It came with 4 GB = 2x2 GB. I've upgraded it to 2x4 GB. Now it's too little, but 2x8 GB costs ~90 Euro. I can have a 64 GB SSD instead of my multi-drive for 40 EUro. So at least for laptops, a dedicated virtual memory SSD looks like a good idea. – texnic – 2015-11-15T21:15:24.510

That's great, as long as you're using a 64 bit OS. Anyone with a 32 bit OS or a system that's limited in RAM capacity, this "SSD as swap" idea could be a very significant solution for them. – Syclone0044 – 2011-11-14T20:45:54.190

@Syclone0044 there is no RAM limit on any n-bit operating system so long as memory support is added properly. Windows 32-bit variants have been capable of addressing more than 4GB of memory for many years now. – Breakthrough – 2011-11-16T12:39:28.030

0

In the grand scheme of things, it all comes down to what you have and what you need. If you are unable to upgrade your ram to where you need it, placing the swap file on an ssd becomes your fastest solution. As far as limited writes go, it is no worse than systems that have the operating system on an ssd . To say it'll cut the life down to 1 or 2 years is incorrect. Hp systems that have an ssd as the system drive, and hence have the swap file there by default are not failing in 1 to 2 years.

Ty Simone

Posted 2011-11-14T18:46:08.413

Reputation: 1

0

I have few low RAM laptops running desktop Linux and various SSD drives, and 4GB is today far too little so they are paging a lot to the SSD. What I have noticed with gnome-disks benchmark, that the areas where there is pagefile slows down a lot very quickly, sometimes it becomes even slower than HDD. So the first workaround I did add "discard" option to the fstab of the swap partition and also I discarded the whole partition and another half of the drive but it didnt improve much, after few months swap partition still had 50% of the performance. I have read that during reboot it is discarded anyway. The second workaround I did was to increase pagefile to over 25GB size by secure erasing drive and reinstalling the whole OS (and while keeping this discard on). After 1 year of operation and heavy use, and lot's of paging, the whole drive has normal performance, including swap partition. Note that this was tested well only on two laptops with two different Kingston drives but with the same controller. In total, over 3 years of heavy swap use, the MLC drive wear is 4% and it's small drive 250GB and the second one is 97%. But the benchmark doesnt show any degradation in both read and write in any part of the drives (well, I tested the one half of the drive which is free and the swap partition). The estimated drive lifespan is 75 years (the pessimistic one based on maximum erase count value which is now around 200 and average one is 130). Of course the drive can fail also in many different ways during this time, but for most of the time it can be recovered with secure erase and recovery from backup, and that has nothing to do with swapping but rather with pulling the plug during writes.

Andrew Smith

Posted 2011-11-14T18:46:08.413

Reputation: 105