What is the advantage of using kernel level buffering for writing files

93 Views Asked by At

I am currently on optimizing the writing speeds for my application and have the possibility to set the file-system buffersize (kernel level) as well as the buffered i/o buffer size (user level). My problem does only concern writing, there is not one read operation on the drive.

I have read that system calls to kernel space take much time. That would affect the overall writing speed when executing a lot of system calls in a short period of time (e.g. when using small buffers for buffered i/o). Therefore I thought to increase the user-level buffer size for buffered i/o write operations. I am expecting no performance decrease when using just buffered i/o for caching when writing files.

In this context my question raised, what advantage a kernel level buffer would bring to an application that does only write content but never reads anything from the disk...

1

There are 1 best solutions below

4
stark On

Caching disk writes has two performance advantages:

  1. When writing the same block multiple times, only the final state needs to be written to disk, so earlier writes are avoided.

  2. Multiple contiguous writes can be written with a single command, reducing command overhead.

Similarly read cache has two main performance advantages:

  1. After reading a block it is kept in cache so a subsequent read of the same block can complete without a disk access.

  2. When reading sequential blocks, the system can do a single large read-ahead so that subsequent reads of new blocks will complete without another disk access.