Description
Hello,
While I was investigating for some performance improvements, I found out that streaming-commons hardcode the default socket recv buffer size to 32kb https://github.com/fpco/streaming-commons/blob/master/Data/Streaming/Network.hs#L267
It was introduced by this commit
8e38589#diff-8c54fc2d40ad45803c6889efbb0192bbR278
The problem is that this 32kb can now be too low for new system which default to higher values, like 128Kb, and cause unnecessary CPU usage and too many syscall.
This hardcoded value also impair flexibility as it forbid the system administrator to modify kernel settings, like /proc/sys/net/ipv4/tcp_rmem, and let the application benefit of it.
The default read buffer size should be based on the kernel setting instead of an hardcoded value.
If I make a PR to something like this, do you think it has a chance to be merged ?
{-# NOINLINE defaultReadBufferSize #-}
defaultReadBufferSize :: Int
defaultReadBufferSize = unsafeDupablePerformIO $
bracket (N.socket N.AF_INET N.Stream 0) N.close (\sock -> N.getSocketOption sock N.RecvBuffer)