Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is a sequential write and what is random write

I want to know what exactly is sequential write and what is random write in definition. I will be even more helpful with example. I tried to google the result. But not much google explanation. Thanks

like image 838
f4fc2791e4473eb2ba41b5ddb445b2 Avatar asked Nov 28 '14 00:11

f4fc2791e4473eb2ba41b5ddb445b2


People also ask

What is sequential write vs random write?

If you have an SSD, sequential operations can also go a bit faster since you're writing or reading from a clump of blocks. Random read/write performance, on the other hand, is about reading or writing small files scattered throughout the drive.

What is sequential write?

Sequential write is a disk access pattern whereby large contiguous blocks of data are written to adjacent locations on the surface of a device at a queue depth of one. The term is used primarily within the context of benchmarking and the speed is usually measured in MBps.

What is sequential and random?

Sequential Access to a data file means that the computer system reads or writes information to the file sequentially, starting from the beginning of the file and proceeding step by step. On the other hand, Random Access to a file means that the computer system can read or write information anywhere in the data file.

What is the difference between sequential and random read/write storage?

Sequentially writing data to that same disk takes about 30ms per MB. So if you sequentially write 100MB of data to a disk, it will take around 3 seconds. But if you do 100 random writes of 1MB each, that will take a total of 4 seconds (3 seconds for the actual writing, and 10ms*100 == 1 second for all the seeking).


1 Answers

When you write two blocks that are next to each-other on disk, you have a sequential write.

When you write two blocks that are located far away from eachother on disk, you have random writes.

With a spinning hard disk, the second pattern is much slower (can be magnitudes), because the head has to be moved around to the new position.

Database technology is (or has been, maybe not that important with SSD anymore) to a large part about optimizing disk access patterns. So what you often see, for example, is trading direct updates of data in their on-disk location (random access) versus writing to a transaction log (sequential access). Makes it more complicated and time-consuming to reconstruct the actual value, but makes for much faster commits (and you have checkpoints to eventually consolidate the logs that build up).

like image 147
Thilo Avatar answered Nov 03 '22 00:11

Thilo