Answer the question
In order to leave comments, you need to log in
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
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.
nothing PassMark
lay out
and finally sqlite3.connect(":memory:") without any disk
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.
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
- 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.
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)
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.
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 questionAsk a Question
731 491 924 answers to any question