B
B
beduin012020-05-03 18:59:01
Solid State Drives
beduin01, 2020-05-03 18:59:01

Why is a RAM disk not faster than an SSD?

I continue to tinker with SQLite and a single insert. I decided to take measurements. The SSD was 3.5 times faster than the HDD. I decided to create a RAM disk and place SQLite there. As a result, I got a zero performance gain.

The question is how can this be? How does recording on an SSD work? Is there a cache system?

Answer the question

In order to leave comments, you need to log in

8 answer(s)
A
Artem @Jump, 2020-05-03
Tag curated by

Why is a RAM disk not faster than an SSD?
It is not clear what you measured and how, therefore, it is impossible to say exactly.
But something can be said
  1. The speed of a program, such as a database, depends on the disk, but this dependence is non-linear. If you put in a disk that is ten times faster, the speed of the program will not necessarily increase ten times, it may increase by 50% or 5% or not change at all.
  2. Most I/O operations are cached by the operating system. Therefore, if your database is small and there is enough RAM, then you will work not with a disk, but with RAM most of the time.
  3. If we are talking about a RAM disk, I would not be surprised if the speed even drops compared to an SSD, this is quite likely. Therefore, firstly, the RAM disk eats up a decent part of the RAM and it may not be enough for efficient caching, and secondly, the RAM disk shuffles information into RAM using the processor, decently loading the latter, therefore, in some heavy tasks, when the processor is under load, the use of the RAM disk can cause a significant performance hit.

If you are interested to know what is in your case - give the details.
What OS. what ramdisk, computer characteristics, database size, how you test - then you can say something without guessing on the coffee grounds.

D
Dimonchik, 2020-05-03
@dimonchik2013

nothing PassMark
lay out
and finally sqlite3.connect(":memory:") without any disk

S
Saboteur, 2020-05-03
@saboteur_kiev

In fact, the speed of a modern SSD may not be inferior to RAM, it depends more on the interface and the implementation of the ram drive. For example, full specification support turns RAM into a rather slow device, and by disabling it, you can significantly increase the speed.
I used a ramdisk for quite a long time, went through different software, sat on a softperfect ram disk for a long time.
But when I switched to m.2 NVME ssd, I realized that the ramdisk is not needed.

D
Drno, 2020-05-03
@Drno

Well, here, in addition to the base itself, the speed of the processor still affects, maybe it rests on it.
In general, yes, normal ssds have a fast cache

R
RA-Habr, 2020-05-04
@RA-Habr

- because your files are of such a size that it is not possible to see the difference in the work of ssd and frames by eye.

D
Danismind, 2020-05-04
@Danismind

In fact, we forget the moment that there is a bus on the motherboard through which all computer components communicate with each other.
Between a hard drive with pancakes that have a rotation speed and a solid-state hard drive that just reads from memory chips, there is a difference. (There is overhead)
But between ssd and ram there is only a ceiling. Or a Motherboard with a more powerful bus and a faster memory. In old computers with a weak bus and memory, ssd can safely work as ram. (The same swap file and speed up the computer)

W
wickated, 2020-05-05
@wickated

Because there is such a thing called iops. And their number is limited, and all these iops are chasing through standard protocols that were invented a long time ago and they are outdated. Nvme didn’t just come up with that. And the data in the ramdisk is chasing through the ram and the processor. And the speed of random copying ram-ram has not been growing for a long time, and in some cases it even drops (hello ddr4 with its timings). The best solution for skl is optan, unless of course the base fits on it.

F
Feliskms, 2020-05-05
@Feliskms

Because the main reason why SSD is faster than HDD is because SSD has very low seek time. When the database is doing work, the HDD is constantly looking for records that are fragmented throughout the disk, and accessing each fragment requires about 10-20 milliseconds to search (let's say 0.015 seconds on average). And the SSD does the search in 1 ms or less, let's say 0.001 seconds. Let's say both HDD and SSD need to do 10 thousand data lookups to complete a query. Then, the HDD will lose 10000*0.015=15 seconds only when searching for fragments. And an SSD will do the same job in 1 second or less. Let's say a RAM disk searches for a fragment in 0.000001 seconds, then it will complete 10000 searches in 0.01 seconds. So it turns out that the HDD stupidly loses 15 seconds while searching for a cluster on the disk, SSD 1 second and RAM 0.01 seconds. And if the difference between 15 seconds and 1 second is huge, then the difference between 1 second and 0.01 second is much less noticeable. If, to fulfill a request, the computer still needs to spend, say, 4 seconds for the processor to work for some calculations, the final time will be - HDD 19 seconds, SSD 5 seconds, RAM 4 seconds ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question