From d8619e76b927d687e94be49333a6f265c1c83b4a Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Sat, 22 Feb 2014 14:04:43 -0500 Subject: [PATCH] Improve interactive latency While typing in confetty console in blind test and confetty was using a TLS socket, the confetty console was noticably chunkier. The chunkiness could not be detected on a UNIX socket. Setting NODELAY on both sides of the socket seems to have eliminated chunkiness so that at least I can't tell confetty from ssh+ipmitool anymore. --- bin/confetty | 1 + confluent/sockapi.py | 1 + 2 files changed, 2 insertions(+) diff --git a/bin/confetty b/bin/confetty index 8bc3b56b..b37736af 100755 --- a/bin/confetty +++ b/bin/confetty @@ -296,6 +296,7 @@ def connect_tls_server(serverstring): af, socktype, proto, cononname, sa = res try: server = socket.socket(af, socktype, proto) + server.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1) except: server = None continue diff --git a/confluent/sockapi.py b/confluent/sockapi.py index 500082a1..97c9f099 100644 --- a/confluent/sockapi.py +++ b/confluent/sockapi.py @@ -133,6 +133,7 @@ def process_request(connection, request, cfm, authdata): def _tlshandler(): plainsocket = socket.socket() plainsocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + plainsocket.setsockopt(socket.SOL_SOCKET, socket.TCP_NODELAY, 1) srv = ssl.wrap_socket(plainsocket, keyfile="/etc/confluent/privkey.pem", certfile="/etc/confluent/srvcert.pem", ssl_version=ssl.PROTOCOL_TLSv1,