Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When should we use a scatter/gather(vectored) IO?

Windows file system supports scatter/gather IO.(Of course, other platform does)
But I don't know when do I use the IO mechanism.

Could you explain me a proper case?

And what benefit can we get from using the I/O mechanism?(Just a little IO request?)

like image 474
Benjamin Avatar asked Aug 22 '10 09:08

Benjamin


3 Answers

You use Scatter/Gather IO when you are doing lots of random (i.e. non-sequential) reads / writes, and you want to save on context switches / syscalls - Scatter/Gather is a form of batching in this sense. However, unless you've got a very fast disk (or more likely, a large array of disks), the syscall cost is negligible.

If you were writing a Database server, you might care about this, but anything less than a big-iron machine handling thousands or millions of requests a second won't see any benefit.

like image 185
Ana Betts Avatar answered Sep 28 '22 07:09

Ana Betts


Paul -- one extra note: one additional advantage is that you hand multiple requests to the disk driver at the same time. The driver then can sort the requests and issue them in the optimal order. While syscall time is small, seek time (many milliseconds) can be punitive (that's less than 1000 I/O's/sec).

Chris's comment about demonstrating the efficiency is pragmatic. Mother nature never lies. Well, almost never.

like image 34
MJZ Avatar answered Sep 28 '22 05:09

MJZ


I would imagine that you would use scatter gatehr IO when you (a) suspected your application had a performance bottleneck, and (b) you built a performance analysis framework that could show significant improvment using it.

Unless you can show a provable improvement, the additional code complexity is just a risk, and theres no magic recipe that says that, when some condition is met, and application will automatically benefit in a significant way from some programming cleverness.

Or - to put it another way - dont base major architectural decisions based on the statements of 'some guy on an internet forum'. Create a test, and find out.

like image 45
Chris Becke Avatar answered Sep 28 '22 07:09

Chris Becke