Howdy
I've been doing some tests here with a net/http server where the handler makes many relatively small writes of binary data to the ResponseWriter. I am ranging over some key-values with a LevelDB iterator, and writing a bunch of the values.
The underlying bufio.Writer's size is hard-coded at 4k:
With this size, my throughput is about 65 MB/sec. Increasing to 64k gets me to 90MB/sec and a 1M buffer gets me to 140 MB/sec.
I have a relatively small number of clients, so I can afford to increase this buffer size.
You can't wrap the ResponseWriter in another bufio.Writer to override the hard-coded buffer size.
The code in the handler could be changed to "stage" its multiple small writes to a bigger buffer which will then bypass the underlying bufio.Writer's buffer when writing, but that seems rather cumbersome.
It looks like a simple 2-line change to add a WriteBufferSize (better name?) to the Server struct to make this configurable.
Thoughts?
Regards
Albert