2
$\begingroup$

On an HDD if data is fragmented the discs need to be spun to where the next block in the file is, so how and where data is stored can make a big difference in how long it takes to retrieve the data. With an SSD is the retrieval time for fragmented data constant (due to no moving parts and it being entirely electronic)? Does this mean it doesn't matter how the data is stored on the drive?

$\endgroup$
  • $\begingroup$ I'm not sure if this is a computer science question. Community votes, please! $\endgroup$ – Raphael Jul 1 '17 at 5:34
3
$\begingroup$

TL;DR: You don't have to worry about seek times with SSDs like you do with hard disks. As a first-order approximation, you can think of them as random-access devices.


SSDs let you read and write entire blocks. There is some cost to read/write a particular block (usually under 0.1ms). Once you're reading or writing a block, it's a lot faster to read/write the rest of the block.

As a consequence, SSDs are almost like random-access devices -- but there is some advantage to having data that will be accessed simultaneously be in the same block, so it does matter to some extent how the data is stored on the SSD.


To dive into some more specifics: A SSD is composed of a bunch of erase blocks (think 512KB or so). Each erase block consists of multiple write pages (think 4KB or so). A SSD supports three operations: read at some location; erase an entire erase-block (making all of those write-pages "blank"); and write to an write-page that is currently "blank".

There's no way to to modify just part of a page. Instead, this is implemented by reading the entire page into RAM, modifying it, writing the entire thing to a blank page, and updating some filesystem data structure to point to the new page instead of the old page.

As a consequence, it's best if writes are clustered at the granularity of the underlying pages. Small, random-access writes are slower; long, sequential writes are faster. Many SSDs contain some kind of cache or "write combining" to try to reduce the impact of this.

To give some example performance numbers: it might take 0.05-0.1 ms to read an entire page, 0.3-1 ms to write a page; and 1-3 ms to erase an erase-block. These are just examples -- don't take them too seriously. Actual performance will vary from device to device.

More reading:

https://en.wikipedia.org/wiki/Flash_file_system

Design Tradeoffs for SSD Performance. Nitin Agrawal ∗ , Vijayan Prabhakaran, Ted Wobber, John D. Davis, Mark Manasse, Rina Panigrahy. Usenix ATC 2008.

Understanding Intrinsic Characteristics and System Implications of Flash Memory based Solid State Drives. Feng Chen, David A. Koufaty, Xiaodong Zhang. SIGMETRICS/Performance 2009.

https://en.wikipedia.org/wiki/Write_amplification

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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