How SSDs are read and written



SSDs that store data in semiconductor memory are superior to HDDs in read / write speed and impact resistance. Data system researcher Peter Bonchi and others explain the mechanism and characteristics of such SSDs.

Database Architects: What Every Programmer Should Know About SSDs
https://databasearchitects.blogspot.com/2021/06/what-every-programmer-should-know-about.html



Random access to the HDD requires physically moving the magnetic head to the correct position on the magnetic disk, which takes about 10 milliseconds. On the other hand, random access to SSD is done to flash memory, so it takes about 1/100 of the time.

SSD is not necessarily to store large files remain bunch, as in the inside are stored across multiple flash chips to separate the smallest unit of storage, and can use all of the flash chip in sequential access hardware An app fetcher is available. However, there is no big difference between sequential access and random access when looking at the flash chip alone, and most SSDs can achieve the maximum speed with random access. To do this, you need to manage hundreds of random IO requests at the same time to keep all flash chips busy, which either spawns a large number of threads or uses an asynchronous I / O interface such as libaio. It is said that it can be realized by doing.

There is another difference between HDD and SSD. HDDs read and write to magnetic disks with only one magnetic head, so they work well only for sequential access , while SSDs use dozens or hundreds of flash memory chips for parallel access. The point is that both of the two access methods work well because they do.

The write speed of SSD is about 10 times slower than the read speed, and it takes about 1 ms. Latency can be measured on consumer SSDs by issuing the sync / flush command after writing. In order to compensate for the high latency at the time of writing and realize a high writing bandwidth, the mechanism of accessing multiple flash chips at the same time at the same time as reading is used for writing. The write cache can write pages asynchronously, so you don't have to manage many writes at the same time for good performance. However, writing occupies a flash chip that is 10 times longer than reading, so latency cannot be completely eliminated.



SSDs have evolved to be extremely inexpensive and high performance. Bonchi et al. Also provide a more detailed tutorial on how to achieve performance.

in Hardware, Posted by log1p_kr