neo4j-go-driver icon indicating copy to clipboard operation
neo4j-go-driver copied to clipboard

Buffered reading.

Open thelonelyvulpes opened this issue 9 months ago • 1 comments

This change introduces a buffered reader between the racing reader and the connection to reduce the number of syscalls required to read messages.

The size of the read buffer is configurable on the driver.

  • Each connection allocates an individual buffer, so memory usage could increase, users should configure this where appropriate, if more syscalls for network reads is seen then increasing the buffer size could help.

Assuming a 16KB Buffer for 100 connections on 3 servers that would equal 16KB * 100 * 3 = ~5MB. N.b. that 300 connections would indicate a very busy client and 5MB should be considered a relatively small increased footprint.

The default read buffer size is: 32K?

thelonelyvulpes avatar May 12 '24 13:05 thelonelyvulpes

~~Tests failing due to bufio.Reader not being thread-safe.~~

Tests fixed

StephenCathcart avatar May 29 '24 16:05 StephenCathcart