Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This is more of a generic question I'm interested in, rather than something I'm planning to use in production. If I got, saym a 40GB SSD drive and allocated the entire drive to be swap space leaving just a small amount of 'real' ram in the system (For examples sake I'll say 512MB physical RAM), how would performance compare to having 40GB of real RAM?
It may not be possible to do a general comparison, so for example running an database server with RedHat, MySQL, MongoDB and Memcached running (In my experience, database servers like a lot of ram, particularly using Memcached) and to save on the fuss lets say all the services have been optimally configured and tuned rather than just stock installs.

TL;DR
Can SSD drives be used as a replacement for ram?

share|improve this question

3 Answers 3

up vote 3 down vote accepted

Swap space is not a simple extension to RAM such that the CPU can access it directly, so on top of the lower speed (compare the maximum throughput of the DDR3 and SATA buses on http://en.wikipedia.org/wiki/List_of_device_bandwidths for instance) and higher latency (even if the access was direct any transfer will be going through the I/O controller and the drive's controller, so there are two lots of latency both of which are likely to be higher than that seen between CPU and RAM), there is also extra processing and latency to consider as the blocks of memory on the SSD will need to be paged into RAM before they can be used, and written back out again if they are modified.

This is particularly relevant for random access (and most in-memory algorithms are written with the assumption that random access is efficient). While the CPU can access any word in RAM more-or-less as and when it likes, but if the data it wants is paged out it will need to read the whole page back in before it can read even a single byte, and a whole page needs to be written if a single byte is modified before the page is purged from RAM to make room for another again.

Of course I'm ignoring the complication of cache RAM here, which means random access is sometimes more efficient than other times (depending on whether the data only exists in main memory or is copied into L3/L2/L1 cache at the time). In theory your RAM is simply cache for your permanent storage, and there are architectures that literally work this way with no distinction between slower permanent storage and faster cache (at least as far as the OS is concerned - it just sees the main storage but faster if the data is also in the faster cache), but the architecture of your hardware and OS are not designed this way.

share|improve this answer
Can SSD drives be used as a replacement for ram?

Yes, especially if you're fond of replacing hardware frequently, for you'll be doing just that quite often - most SSDs start to die pretty quickly if you're writing more than 35GB per day to them.

share|improve this answer
    
I wasn't planning on using it in production for that very reason =) I was just interested from a performance perspective. –  sam May 22 '11 at 13:14

Can SSD drives be used as a replacement for ram?

You could answer this question yourself by comparing RAM access times (magnitude of 10 nanoseconds) and throughputs (magnitude of 10 GB/s) with the SSD access times (magnitude of 1 millisecond) and throughputs (magnitude of 100 MB/s).

If it is okay for your application to have "RAM" that is about 100 - 100,000 times slower than usual, then yes, SSDs could be used as a replacement for RAM.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.