Changeset

11689:f9f6e82fb572

net.server_epoll: Add setting for disabling the Nagle algorithm Nagle increases latency and is the bane of all networking!
author Kim Alvefur <zash@zash.se>
date Wed, 14 Jul 2021 22:27:12 +0200
parents 11688:3fc564f7441b
children 11690:4e36a1e7222b
files net/server_epoll.lua
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_epoll.lua	Wed Jul 14 22:13:30 2021 +0200
+++ b/net/server_epoll.lua	Wed Jul 14 22:27:12 2021 +0200
@@ -83,6 +83,9 @@
 
 	-- 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 @@
 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