memory management - Difference between sequential write and random write -
what difference between sequential write , random write in case of :- 1)disk based systems 2)ssd [flash device ] based systems
when application writes , information/data needs modified on disk how know whether sequential write or random write.as till point write cannot distinguished "sequential" or "random".the write buffered , applied disk when flush buffer.
please correct me if wrong.
when people talk sequential vs random writes file, they're drawing distinction between writing without intermediate seeks ("sequential"), vs. pattern of seek-write-seek-write-seek-write, etc. ("random").
the distinction important in traditional disk-based systems, each disk seek take around 10ms. sequentially writing data same disk takes 30ms per mb. if sequentially write 100mb of data disk, take around 3 seconds. if 100 random writes of 1mb each, take total of 4 seconds (3 seconds actual writing, , 10ms*100 == 1 second seeking).
as each random write gets smaller, pay more , more of penalty disk seeks. in extreme case perform 100 million random 1-byte writes, you'll still net 3 seconds actual writes, you'd have 11.57 days worth of seeking do! degree writes sequential vs. random can affect time takes accomplish task.
the situation bit different when comes flash. flash, don't have physical disk head must move around. (this 10ms seek cost comes traditional disk). however, flash devices tend have large page sizes (the smallest "typical" page size around 512 bytes according wikipedia, , 4k page sizes appear common well). if you're writing small number of bytes, flash still has overhead in must read out entire page, modify bytes you're writing, , write entire page. don't know characteristic numbers flash off top of head. rule of thumb on flash if each of writes comparable in size device's page size, won't see performance difference between random , sequential writes. if each of writes small compared device page size, you'll see overhead when doing random writes.
now of above, it's true @ application layer hidden you. there layers in kernel, disk/flash controller, etc. example interject non-obvious seeks in middle of "sequential" writing. in cases, writing "looks" sequential @ application layer (no seeks, lots of continuous i/o) have sequential-write performance while writing "looks" random @ application layer have (generally worse) random-write performance.
Comments
Post a Comment