Abstract


  • A buffer serves as a temporary storage area that consolidates multiple pieces of data before they are read from or written to an IO Device/Socket by the Kernel

Better performance

This consolidation helps optimise data transfer by minimising the overhead associated with individual data transfers, which require system calls, and also helps smooth out disparities in data transfer rates between different system components.

Example

IO Device Buffering

  • In java, Scanner has a worse performance than BufferedReader, in terms of reading in a file.

Network Domain Socket Buffering

  • The white part of the progress indicates the data that is buffered. In this case, this data is basically part of the video that is ready to be watched without the need to fetch from the Server. If we don’t buffer and the data takes half a second to reach due to poor network connectivity, the user will feel the video isn’t playing smoothly, bad user experience!