If RAM is scarce, can't just a RAID of many HDDs serves as RAM?

Ok.
Say your system has 1GB ram, it will run storj better with some swap.
Can you agree?


Storj doesn’t use CPU - ~1%
Stor doesn’t use memory - 5 nodes are using <1GB
Storj does use cache - here you see that even on this over provisioned system with 32GB ram it has found .2MB that it can swap out and use as cache.
That .2MB is faster than going to disk. Without swap it would be slower.

LMAO. That’s a funny scenario, but I’ll calc. it out for you:

Ok imagine if you set a Raid 5 on 8 SATA III ports… Then you purposely wanted the kernel to wander around and execute only in that space. To avoid all the above pointless debate on the concept of swap files, which OP didn’t ask about.

Effectively you would have created a computer that uses ~ DDR2-533 memory (PC2-4200). Haha, older Windows OS versions could get trapped executing entirely from on-demand swap memory, yeah it would take an hours to do anything (even to kill apps and free up space so kernel could be live again); however, that example wouldn’t represent a raid concept.

Effectively you would have ram going at 4,200 MB/s for the kernel to do it’s step execution of operands, or a 525 MHz computer. This permanent, non-volatile ram concept is entirely possible, with many caveats. Say 7x 8TB SSDs, you could run a 56 TB OS, and yes even Windows can go higher than that. I’m positive you could probably do it with TSR DOS Ram disk &/or Network I/O drivers preloaded to Windows 2000 or NT easily; as there have been those ‘Angel’ drivers, if I remember the name correctly which were specifically made to run Windows kiosks - entirely in RAM. Other ways, such as SAS raid cards for raid, with virtual machine limitations imposed, etc. etc. Not going to entirely brain storm down that road.

Of course, page reads and execution would be great but what would really slow it to much less than half that MHz rate would be the manipulation of ‘memory’ pages themselves, the seek and latency issues, etc. in due consideration of an OS’s common read/write % patterns.

I have 6TB of ram, even if my ram is half as fast as ddr 5, I can do fun stuff with it, because I have virtual environments, high speed networking, and multiple enterprise servers (and it didn’t cost an arm and a leg). For instance, I had configured a TB ram drive over networked nodes, just to defrag drive images super fast.

So anything is possible.

5 cents,
Julio

1 Like

Perhaps more amusing for the example above, you’d prolly want to allocate the entirely unused RAM to a ram drive, and put the swap file on it - lol! Just to be extra efficient! :slight_smile: Not unlike the concept of PMem, it’s a thing. Image how fast you could kill all those SSDs with COW -lol, then again it could be on spinning rust, with a 5-6 Ms seek time - lol, about 100x slower. Yeah! a single digit maybe double didget Mzh computer like back in the 80s.

Things that make you ‘hummmmm,’ in a high intonation. Kinda fun thought experiment.

2 extra cents,
Julio

Or… since the AI servers have all the RAM and drives now, you could ask the AI of your choise to run a virtual machine with your entire system, and you just need a pc with internet connection.

1 Like

No one is claiming “Less RAM is better”. Memory is orders of magnitude faster than disks and having more is (almost) always better. No one (except maybe OP in his naivité) is seriously debating that. But this statement is not correct:

The argument is: A system with SWAP can (in many scenarios) perform better than an identical system (same hardware, same set of workloads) without SWAP

Because: A System without SWAP is by definition unable to reclaim valuable RAM allocated to idle applications, thereby wasting it instead of being able to use it for something more performance critical (at that point in time).

A better way to say things might be: Using SWAP will always be slower than just getting more RAM, but that’s not really an option everyone has…

Say I have a Factorio Server and a Database on the same Machine and both are up to accept incoming connections, but otherwise idle (Factorio pauses the Simulation if nobody is connected, the database also doesn’t do much without incoming queries).

If I now start to hammer the database the DBMS might significanly benefit from having more memory available for processing and caching. And even if the process itself doesn’t allocate more RAM having frequently read file blocks already in memory can also significantly improve performance.

If the Factorio server is idle, it still has a bunch of stuff loaded and is using several GB of memory to respond to and resume running on incoming connections. Whether that’s optimal and I agree with that decision or not, I can’t change it (without halting the server).

Without SWAP the OS has 3 options:

  1. Kill one of the processes (undesirable, only option if memory is critically low)
  2. Give less new RAM to the other process and deny (some) requests to allocate more (risky, application might not handle failing malloc() gracefully)
  3. Drop file caches (in I/O heavy tasks like a database this leads to disk thrashing where the same group of files are read in for a few I/O operations and immediately evicted for some other file, that’s then evicted again to load the first, etc., etc.)

With SWAP there’s a 4th way: SWAP out inactive memory from processes not currently using it. Yes it has to be loaded back in if (not when) it ever needs to be used again, but by then the overall system state might be drastically different and the memory pressure might have passed.

This can be true even if the System has several GB of “available” memory. Sometimes having your entire working dataset in RAM and being able to quickly access more of it (even if only through the block cache) is more valuable than keeping that forgotten browser window on another desktop actively loaded.

It can cause a latency spike on initial access after being swapped out. But unlike killing the process it is mostly transparent and the minutes of time saved by using that memory more optimally (like for the database when it was beneficial) can and does more than make up for it (in many situations).

We drop disk caches when there’s better things to to with that RAM, despite many Applications blocking on I/O. There’s no reason not to “drop (swap out)” inactive application memory if there’s something better (like another app’s allocation or extremely frequently used files) it could be used for.

1 Like