Buffering tweaks¶
We (can) set various server-side socket options that affect buffering. The values are stored in C structures without real Lua bindings, so setting them is a bit long.
- (require 'ffi').C.the_worker.engine.net.tcp.user_timeout
On TCP-based server-side sockets we set
TCP_USER_TIMEOUT
option if available (~Linux). We use default 1000, i.e. one second. For details see the definition inman tcp.7
.
- (require 'ffi').C.the_worker.engine.net.listen_tcp_buflens.snd
- (require 'ffi').C.the_worker.engine.net.listen_tcp_buflens.rcv
- (require 'ffi').C.the_worker.engine.net.listen_udp_buflens.snd
- (require 'ffi').C.the_worker.engine.net.listen_udp_buflens.rcv
If overridden to nonzero, these variables instruct the OS to modify kernel-space buffers for server-side sockets. We split the setting for UDP vs. TCP and sending vs. receiving.
For details see
SO_SNDBUF
andSO_RCVBUF
inman socket.7
. There is no user-space buffering beyond immediate manipulation, only the OS keeps some.