Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

RAM is cheap, and much faster than SSDs. It's just volatile. So why don't computers have a LOT of RAM, and on power up, load everything to the RAM from the hard drive/SSD and just run everything from there, assuming there's no real need to persist anything outside of memory? Wouldn't computers be much faster?

Of course, current operating system may not support this at all, but is there any reason RAM isn't used this way?

share|improve this question

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

99  
You assume RAM is cheap. How much does 1TB of RAM cost? –  Alan Shutko Aug 27 '13 at 15:28
33  
What you describe is called a RAMDisk and people already do what you describe. I load most of my programs in memory using a RAMDisk. You also don't need special hardware you can use system memory and software to do this. –  Ramhound Aug 27 '13 at 15:38
14  
We do, under the covers, to the extent that a given OS supports it. Windows uses "unused" RAM for "disk cache", and I assume that many versions of Linux do too. But there is far too much disk to ever fit it all into RAM. –  Daniel R Hicks Aug 27 '13 at 20:03
16  
"cheap" is a relative term. Each bit of memory is cheaper than it was a couple years ago, but it's more expensive than storage on a hard drive. And anyway the march of progress will ensure that programs always fill up all available RAM no matter how much is available; if everybody's computer suddenly had more RAM available, developers would put more stuff into their programs. –  jhocking Aug 27 '13 at 20:40
13  
Google loads the internet to RAM –  Ari Aug 27 '13 at 22:07
show 17 more comments

12 Answers 12

up vote 155 down vote accepted

There are a few reasons RAM is not used that way:

  1. Common desktop (DDR3) RAM is cheap, but not quite that cheap. Especially if you want to buy relatively large DIMMs.
  2. RAM loses its contents when powered off. Thus you would need to reload the content at boot time. Say you use a SSD sized RAMDISK of 100GB, that means about two minutes delay while 100GB are copied from the disk.
  3. RAM uses more power (say 2–3 Watt per DIMM, about the same as an idle SSD).
  4. To use so much RAM, your motherboard will need a lot of DIMM sockets and the traces to them. Usually this is limited to six or less. (More board space means more costs, thus higher prices.)
  5. Lastly, you will also need RAM to run your programs in, so you will need the normal RAM size to work in (e.g. 18GiB, and enough to store the data you expect to use).

Having said that: Yes, RAM disks do exist. Even as PCI board with DIMM sockets and as aplicances for very high IOps. (Mostly used in corporate databases before SSD's became an option). These things are not cheap though.


Here are two examples of low end RAM disk cards which made it into production:

Note that there are way more ways of doing this than just by creating a RAM disk in the common work memory.

You can:

  1. Use a dedicated physical drive for it with volatile (dynamic) memory. Either as an appliance, or with a SAS, SATA or PCI[e] interface.
  2. You can do the same with battery backed storage (no need to copy initial data into it since it will keep its contents as long as the backup power stays valid).
  3. You can use static RAMs rather then DRAMS (simpler, more expensive).
  4. You can use flash or other permanent storage to keep all the data (Warning: flash usually has a limited number of write cycles). If you use flash as only storage then you just moved to SSDs. If you store everything in dynamic RAM and save to flash backup on power down then you went back to appliances.

I am sure there is way more to describe, from Amiga RAD: reset surviving RAM disks to IOPS, wear leveling and G-d knows what, However I will cut this short and only list one more item:

DDR3 (current DRAM) prices versus SSD prices:

  • DDR3: € 10 per GiB, or € 10,000 per TiB
  • SSDs: Significantly less. (About 1/4th to 1/10th.)
share|improve this answer
8  
+1 for hitting two critical points: HD's are still cheaper than RAM, and RAM is volatile.RAM is your work bench, and your HD's is the warehouse. Nuf sed. –  hydroparadise Aug 27 '13 at 16:12
1  
@Hennes - Wasn't suggesting loading the entire drive into memory with a software RAMDisk solution. You can load say Photoshop from a mechanical drive into a RAMDisk using junction points and performance would be better or as good as a SSD installation. –  Ramhound Aug 27 '13 at 16:26
25  
+1 for "RAM's cheap, but not that cheap". A quick search shows that SSD drives are currently selling for between 75 cents to a buck a gig depending on capacity and manufacturer. DDR3 RAM modules, depending on capacity, sell for between $7-10 per GB, so the ratio of RAM to SSD cost can be as much as 15:1. –  KeithS Aug 27 '13 at 17:49
    
Actually, the I-RAM device was massively cheaper than the EasyCo one - but sadly no longer available. Nor is its successor the GC-Ramdrive. –  symcbean Aug 27 '13 at 21:20
1  
I disagree. The flash cells on the SSD might not need power, but the controller and other electronics on the SSD draw power. Not much power, but roughly the same as the power drawn by a a modern DIMM (1-3 Watt). –  Hennes Aug 29 '13 at 4:24
show 8 more comments

Operating systems already do this, with the page cache:

In computing, a page cache, often called a disk cache, is a "transparent" cache of disk-backed pages kept in main memory (RAM) by the operating system for quicker access. A page cache is typically implemented in kernels with the paging memory management, and is completely transparent to applications.

When you read a page from a disk, your operating system will load that data into memory, and leave it there until it has a better use for that memory. If you have sufficient memory, your OS will only read each page once, and then use it from memory from then on. The only reason the OS will do real disk IO is if it needs to read a page that's not already in memory, or if a page is written to (in which case, you presumably want it saved to the disk).

One advantage of doing things this way is that you don't have to load the entire hard drive into memory, which is useful if it won't fit, and also means you don't waste time reading files that your applications don't need. Another advantage is that the cache can be discarded whenever the OS needs more memory (it's better to have your next disk read be slightly slower, than to have your programs crash because they're out of memory). Also, it's useful that users don't need to manually decide what should be in the ramdisk or not: Whatever you use most often will automatically be kept in main memory.

If you have a lot of memory, but your applications aren't running as fast as you would expect, there's a good chance they're slower because they're running safely. For example, SQLite is orders of magnitude faster if you tell it not to wait for writes to complete, but your database will be completely broken if you don't shutdown cleanly.

Also, /tmp is usually a ramdisk on Linux distros, because it's ok if that data gets lost. There's still some debate over whether that's a good idea though, because if too much data gets written to /tmp, you can run out of memory.

share|improve this answer
5  
Great answer. OS's also have features like Superfetch, which will load commonly requested data from the disk into RAM at boot time. –  Matthew Lock Aug 27 '13 at 23:34
add comment

As Alan Shutko points out in his comment on the question, RAM isn't actually cheap. :)

Here are some data points. When I search on Google for 4 GB RAM, 64 GB SSD and 1 TB HDD (mechanical hard drive), here are the costs I see (this is for Aug 25, 2013):

Whoa! HDDs are 100x cheaper than RAM! And SSDs are 8x cheaper than RAM. :)

(Plus, as pointed out in other answers, RAM is inherently volatile, and so you need some other form of persistent storage.)

share|improve this answer
2  
RAM is several orders of magnitude faster than SSD (without the write wear problem) which are several orders of magnitude faster than spinning rust and GLASS. And sure you can by a 1TB disk for $80, but try finding that storage on a 15k rpm platter with SCSI or fibre channel connectivity. You're looking at 4 x 250Gb @ ~ $250 plus the cost of a BBU controller (approx $500) making the cost around the same as an SSD. –  symcbean Aug 27 '13 at 21:25
1  
@symcbean - That's somewhat nitpicking; bear in mind that getting RAM in large denominations (as you'd want in order to replace a disk or SSD) costs more like $25/GB. –  Russell Borogove Aug 27 '13 at 23:23
2  
@symcbean buying an SSD with similar enterprise characteristics will cost well over $1000. –  mikebabcock Aug 28 '13 at 3:09
    
It would be very interesting to see this answer being revisited every few months and having the price amended, and see how prices dropped constantly. –  Ofer Zelig Aug 28 '13 at 3:15
    
@OferZelig "see how prices dropped constantly" You mean except when they don't? –  Michael Kjörling Aug 28 '13 at 9:47
show 1 more comment

I do all my immediate read/write operations for content generation in RAM disks on my local machine. I also store my MongoDB journaling folders there, as well as my compilers and Python interpreters and standard library. This disk is saved on shut down and restored on start. The second RAM disk I use is 64 megabytes and all my internet browser's cache folders point there; that one is lost on shut down, and flushes itself when it's full.

Use the right tools for the job I suppose, would be the answer I give you. I'm generating data 30-1000x faster using a RAM disk than on my 7200rpm Western Digital.

This is the program I'm using: http://www.romexsoftware.com/en-us/primo-ramdisk/

...and when 32gigs of Ram is less than $200, I don't see why this isn't becoming more common.

8 gig RAM diskeveryday SATA III HDD

share|improve this answer
2  
You know that the OS caches things for you already, right? –  Potatoswatter Aug 28 '13 at 9:44
    
"when 32gigs of Ram is less than $200" 32 GB on a 1 TB HDD starts out at around $3, give or take; consumer 1 TB drives go for less than $100 today, and even enterprise grade drives can be had for similar per-gigabyte prices (Amazon wants $408 currently for the 4 TB Seagate ST4000NM0043 which sports a RRP of $520, and that's single units without even shopping around). –  Michael Kjörling Aug 28 '13 at 9:52
1  
@Potatoswatter yeah, it does. But it doesn't cache 10,000 newly created files. So, I explicitly "cache" them on my RAM disk. –  blakev Aug 29 '13 at 17:36
    
@MichaelKjörling We're not trying to store 1 TB in RAM. That's ridiculous. Be realistic and pick a few key folders you always want to have in RAM and you can SIGNIFICANTLY (orders of magnitude) speed up certain operations in your workflow. See my images above. –  blakev Aug 29 '13 at 17:38
    
Copying from the question: "on power up, load everything to the RAM from the hard drive/SSD and just run everything from there" That seems to me to imply reading everything off the hard drive into RAM (and it's also the basis of a lot of the other answers to the question). Also, if you look at my comment again, you'll see that my point was that "32 GB of RAM is less than $200" is hideously expensive compared to secondary storage such as a HDD. –  Michael Kjörling Aug 29 '13 at 18:39
show 5 more comments

Yes this is the premise of many in-memory databases that are coming up on the market. One example is SAP HANA. The idea is that RAM is cheap and from a performance point of view read / write operations on RAM are 1000x faster than disk operations. So most of the data is kept in the RAM and then you define a data ageing strategy using which the old data is recycled back to cold storage (i.e. disk).

share|improve this answer
add comment

Short explanation:

First time an application is executed, it is transferred from hard-disk or network to the RAM. So, don't worry, you already do it.

But, usually, there is not only one application/process file and there are some I/O operations targeted to hard disk or network (other files of the application or other I/O operations with system etc.), which can slow down your application. Those could be directed to RAM-disk, but you should consider that RAM-disk deletes on power-off and should be filled again on start-up.

And RAM is not that cheap as presented in the question. You should count not only the cost of the RAM, but the cost of the working RAM, including sockets on your motherboard (those are limited/rare and thus more valuable) and cost of lost data, when power is going down.

For example computer with 1TB HDD could be bought for cheap and it is about home computing, computer with 1TB of RAM is in ranges of supercomputers. (but Intel is working on something mid ranged: http://vr-zone.com/articles/more-on-xeon-e5-terabyte-of-ram-even-at-midrange-/14366.html)

share|improve this answer
add comment

This is a GREAT question and I find the responses fascinating. I am going to comment on this as an Oracle DBA and my answers are SPECIFIC to the oracle database. This is a major mistake alot of people make when working with Oracle. I am not sure if this applies to other applications as well. This is not meant to be off topic, but is meant as a specialized answer.

When you tune performance with oracle, you are really looking to clear up bottlenecks. Though most of us don't say it, it is based on the Theory of Constraints: http://en.wikipedia.org/wiki/Theory_of_constraints

Memory may not be your bottleneck. Oracle has complex mechanisms for managing memory and just increasing memory can actually slow things down if other areas are where the bottleneck is. Let me give you one example that is VERY common.

Queries seem to be slow. The consensus is if we increase RAM, we should increase the response time of queries since memory is faster than disc. Well... This is how Oracle handles memory manage for data. Oracle has a variety of memory locations that are allocated to specific duties. So you can increase these memories. The area used for data is called the 'buffer cache'. This is a series of linked lists(the number of them tend to increase with each version). Everytime a block is found on disc during a query a hash algorithm is run on it to determine which list to stick it in. Where to put it in the list is based on a touch count algorithm (explain on the oracle support site, so you have to pay to get it... its not real important).

HOWEVER, when you run a query oracle takes out a latch on the buffer chain you search at the time. This LATCH (note this is not a lock. google latch if you dont know the different) blocks all other operations on that chain for the duration of your read. So it blocks reads AND writes (this is entirely different than oracle claiming locks dont block reads).

This is necessary because as you read the block in the chain, oracle moves it around based on how often it is 'requested'. More frequently requested blocks are moved to the top and less frequently requested blocks are left at the bottom and aged out. You cannot have 2 sessions reading a linked list and moving blocks around or you will hit pointers that point to non-existent locations.

When you increase the size of memory, you increase the size of each linked list. This increasing the time it takes to read the list. A single poor query or complex query can do 10s of thousand or even millions of reads down linked lists. Each read is fast, but the number of them leads to latches taken and these will block other sessions. Oracle calls this a 'logical IO'(or buffer get or some other stuff. This lingo is specific to oracle and may mean something else in other parts of IT).

So if the list is longer and you have really bad SQL than the SQL statements will hold their latches longer. Increasing memory can occassionally REDUCE performance. Most of the time this won't happen. People will spend alot of money and see no benefit. That being said there are times when you need more memory in the buffer cache, but you have to properly identify the bottleneck to know whether this is appropriate. I can't discuss how to analyze this in this post. See the DBA forums. Some people discuss it there. It is rather complex.

Does anyone have specific examples with other pieces of software where this can happen? There is a terrific business book called 'The Goal' that discusses alleviating constraints in a factory. This process is very similiar to what Oracle DBAs do when assessing performance issues. It is often standard reading in MBA programs. It is very valuable to read for IT professions.

http://en.wikipedia.org/wiki/Eliyahu_M._Goldratt

share|improve this answer
    
Not shure this is revelant to the question, but otherwise interesting. –  jb. Aug 28 '13 at 16:11
    
its a reason not to just add ram. It is specific, and narrow, but I think it applies. –  Bob Aug 28 '13 at 16:14
    
very interesting. It brings another angle to the overall discussion. –  Lo Sauer Aug 29 '13 at 21:06
add comment

RAM may be cheap but not as cheap as traditional storage.

I have a 3TB Hard Drive($99): HDD Quote

And you will need 48 of these for 3TB at ($719) each: RAM Quote

That would total $34,512 vs $99. Not to mention the price of the hardware required to run 3TB of RAM.

share|improve this answer
    
the answer is not relevant to the question –  BlueBerry - vignesh4303 Aug 28 '13 at 4:44
1  
I think at the end he is trying to say "RAM is NOT cheap." –  jaczjill Aug 28 '13 at 8:17
    
Also you can't possibly connect 48 of those 8 channel kits into any device that I know of. Although there are systems that accept 16 (or more) 64 GB REG ECC dimms into a single server. However these are not cheap at all. –  drescherjm Aug 28 '13 at 18:09
add comment

It actually is done in some scenarios. If you have an operating system/app stack small enough, you can run it entirely in RAM. Of course it has all the disadvantages that the accepted answer has. But it is possible and does happen.

Take a look at Puppy Linux, a popular Linux distribution. Their how it works page talks about running from RAM: http://puppylinux.org/wikka/howPuppyWorks

share|improve this answer
    
And of course, in a cluster environment, you can keep the app stack on a distributed/network filesystem, serve the base OS via PXE or similar, and run the nodes diskless if you want. –  Aesin Aug 28 '13 at 20:35
add comment

You are actually right In the near future, all storage and memory will be in the form on nano ram. NRAM is basically "mechanical" switches that are a few atoms wide, It doesn't need current to maintain state so it is energy efficient and doesn't need to be cooled down and because the switches are so small the density is very high and this is good for two reasons, one is the access to memory is very fast and you'll be able to have terabytes of data on small devices like cellphone. if you like to read more see this: http://www.nantero.com/mission.html and this http://en.wikipedia.org/wiki/Nano-RAM

share|improve this answer
add comment

I think the answer partially can be answered as follows:

Premise:

  • Only those type of RAM are cheap that are produced and sold in great quantities
  • RAM manufacturers want to sell their product.
  • low prices demand selling great volumes to turn a profit
  • a large userbase uses an established memory-technology
  • new memory technology takes years to get widely adopted
  • memory slots are highly limited in the ever smaller devices of said userbase
  • mobile technology is increasing
  • at least 0.1% of 1Bil. PC users might opt for 128GB RAM or more (guesswork)
  • technology-updates which are in high demand turns a higher profit than new technology-generations

Given the limited number of memory-slots, an important solution comes in form of higher memory chips with smaller internal dimensions, and / or 3D stacking. Both processes progressed as expected over the past 36+ months.

So the question is: "DDR3 maximum memory size" or semantically: "DDR3 why are there no memory modules greater than 16GB"

And the answer is:

The DDR3 standard allows for chip capacities of 512 megabits to 8 gigabits, effectively enabling a maximum memory module size of 16 gigabytes (src )

DDR4 will change this, as outlined in this technology-map:

enter image description here

Result:

  • a semi-deadlocked memory-market
  • Apple Macbook Pro extravaganza stopping at measly 16GB
  • greater demand for cloud or remote services (to house those Virtual Machines and InMemory databases many developers and engineers would just as happily run locally)
  • ...???

Some caveats to Hennes'es thorough post:

  • Common desktop (DDR3) RAM is cheap, but not quite that cheap: cheap enough for certain people to buy it due to their data-intensive background
  • RAM loses its contents when powered off: Humans have tackled harder problems than volatile memory. The patents and solutions on "handling volatile memory" since 2010 are testimony to that.
  • RAM uses more power: selectively switch off unused memory(banks) in mobile devices. Also 1W to 2W pales in comparison to 800W GPUs
  • you will need a lot of DIMM sockets: chip-technology still progressed as usual, meaning the option of higher memory-chips doesn't just exist, but chip-makers would happily sell them to you in high quantity
  • you will also need RAM to run your programs in: True. But the pkr298 presumes that the entire OS and programs are loaded into RAM, not that it ought to abolish

the hard drive/SSD

share|improve this answer
    
Switching off unused memory banks in DRAM is a problem. DRAM technology requires the cells to be refreshed. COmpare this to a leaky bucket. If I fill it with water (electricity) it represents a 1, if I empty it it represent a 0. Sadly the bucket is leaky and stands in shallow water. A full bucket will slowly empty itself until it matches the water level. An empty bucket will slowly until it matches the water level. After a a while there is not telling what the state of the bucket was. –  Hennes Sep 1 '13 at 13:42
    
To solve this someone walk past the bucket every now and then. If it is mostly full the bucket will be topped off; if it is mostly empty it will be emptied completely. This is a refresh. Refreshing a memory cell takes energy, preventing DRAM from being fully switched off while keeping their contents. --- There are ways around this, e.g. SRAM does not need the external refreshes and can still keep its contents, but it requires more silicon (thus smaller or more expensive chips). –  Hennes Sep 1 '13 at 13:43
add comment

As others have said RAM is volatile and something like 10x the cost of SSDs.

However, there IS a product out there that comes pretty close to what you're describing--unfortunately I can't recall the name.

What it is is RAM-based drive (IIRC max 64gb) coupled with a CF card and a battery. When you turn the system on it copies the contents of the CF card to the RAM (I believe serving requests from the CF card if they haven't yet been loaded.) On shutdown the contents of the RAM are copied to the CF card--the battery is big enough to permit this to finish before it's depleted.

It's not cheap.

share|improve this answer
add comment

protected by Community Aug 28 '13 at 20:35

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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