Use TCP_NODELAY for created sockets.
Mark Seger at HP has been looking at small objects, 1 and 2 KB size, and with Rick Jones' help noticed that TCP protocol traces showed effects from the Nagel algorithm client-to-server and server-to-client. This patch just addresses our WSGI server responses, but does not address out-bound connections from the various servers. Change-Id: I11f86df1f56fba1c6ab6084dc1f580c395f072dc Signed-off-by: Peter Portante <peter.portante@redhat.com>
This commit is contained in:
parent
4d6a9bfee1
commit
3c7c355120
@ -169,6 +169,7 @@ def get_socket(conf, default_port=8080):
|
|||||||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
# in my experience, sockets can hang around forever without keepalive
|
# in my experience, sockets can hang around forever without keepalive
|
||||||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
|
sock.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
|
||||||
|
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
||||||
if hasattr(socket, 'TCP_KEEPIDLE'):
|
if hasattr(socket, 'TCP_KEEPIDLE'):
|
||||||
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 600)
|
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 600)
|
||||||
if warn_ssl:
|
if warn_ssl:
|
||||||
|
@ -246,11 +246,13 @@ class TestWSGI(unittest.TestCase):
|
|||||||
socket.SO_REUSEADDR: 1,
|
socket.SO_REUSEADDR: 1,
|
||||||
socket.SO_KEEPALIVE: 1,
|
socket.SO_KEEPALIVE: 1,
|
||||||
},
|
},
|
||||||
|
socket.IPPROTO_TCP: {
|
||||||
|
socket.TCP_NODELAY: 1,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if hasattr(socket, 'TCP_KEEPIDLE'):
|
if hasattr(socket, 'TCP_KEEPIDLE'):
|
||||||
expected_socket_opts[socket.IPPROTO_TCP] = {
|
expected_socket_opts[socket.IPPROTO_TCP][
|
||||||
socket.TCP_KEEPIDLE: 600,
|
socket.TCP_KEEPIDLE] = 600
|
||||||
}
|
|
||||||
self.assertEquals(sock.opts, expected_socket_opts)
|
self.assertEquals(sock.opts, expected_socket_opts)
|
||||||
# test ssl
|
# test ssl
|
||||||
sock = wsgi.get_socket(ssl_conf)
|
sock = wsgi.get_socket(ssl_conf)
|
||||||
|
Loading…
Reference in New Issue
Block a user