From 005e93100580f29f888d361977d35eb391e7097d Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 14 Jul 2021 22:27:12 +0200 Subject: net.server_epoll: Add setting for disabling the Nagle algorithm Nagle increases latency and is the bane of all networking! --- net/server_epoll.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'net') diff --git a/net/server_epoll.lua b/net/server_epoll.lua index 4ffaf506..415abd7f 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -83,6 +83,9 @@ local default_config = { __index = { -- TCP Keepalives tcp_keepalive = false; -- boolean | number + + -- Whether to let the Nagle algorithm stay enabled + nagle = true; }}; local cfg = default_config.__index; @@ -731,6 +734,9 @@ function interface:init() end function interface:defaultoptions() + if cfg.nagle == false then + self:setoption("tcp-nodelay", true); + end if cfg.tcp_keepalive then self:setoption("keepalive", true); if type(cfg.tcp_keepalive) == "number" then -- cgit v1.2.3