Perf improvements: Use default os setting for socket recv buffer size
+ This commit 8e38589efb (diff-8c54fc2d40ad45803c6889efbb0192bbR278)
introduce a default fixed size read buffer which is too low for most modern system. Thus it induce a lot of unecessary syscall and cpu usage.
Use the default OS settings in order to let the user control it with
ie: /proc/sys/net/ipv4/tcp_rmem
Former-commit-id: 1fc22266bf6cda96ec8c43b52cc6da527db35173
Former-commit-id: f9cbaa2ce612df6cbfc88963a32b0a0e38c1e13e [formerly 18c0558ec79d6a82ef242b114a63738a81329ec5] [formerly 5aa78fa4a16ac891f169a02275d147ec12fc336f [formerly 32204a8d46a8f4d06e40c15380e68afa4dd1f294 [formerly 32204a8d46a8f4d06e40c15380e68afa4dd1f294 [formerly 32204a8d46a8f4d06e40c15380e68afa4dd1f294 [formerly 11e560d1fae42a64cd645e79343209e6559473d9]]]]]
Former-commit-id: 8e4ccba7062154cdaba142c6110b32b05ca08e37 [formerly a7d2f3299f4c67ea0ec9d20cbf2780382258e143]
Former-commit-id: c9ebc4a70b48e7433d65af79ef161d2b0d510f61
Former-commit-id: b5056ca3dda1f23f3bc5d8e093772874b5666fbb
Former-commit-id: 7a25a6703c1c0396425d40f4080162b43179b96d
Former-commit-id: c6d4da14dfcbb373dcb3341f246bd6675f44e4e7 [formerly 5f081b250a55f9fa091a8f13927e4c2d7980ef2a]
Former-commit-id: 886b1fa73005e8167949ede1391086d3f6ed3e00
This commit is contained in:
parent
df927db68e
commit
8ca1ed9fb3
1 changed files with 2 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
module Types where
|
||||
|
||||
|
||||
import ClassyPrelude
|
||||
import Data.Maybe
|
||||
import System.IO (stdin, stdout)
|
||||
|
@ -25,7 +26,7 @@ deriving instance Hashable PortNumber
|
|||
deriving instance Generic N.SockAddr
|
||||
deriving instance Hashable N.SockAddr
|
||||
|
||||
|
||||
{-# NOINLINE defaultRecvBufferSize #-}
|
||||
defaultRecvBufferSize :: Int
|
||||
defaultRecvBufferSize = unsafeDupablePerformIO $
|
||||
bracket (N.socket N.AF_INET N.Stream 0) N.close (\sock -> N.getSocketOption sock N.RecvBuffer)
|
||||
|
|
Loading…
Reference in a new issue