summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2023-02-13 21:46:40 -0800
committerTim Burke <tim.burke@gmail.com>2023-04-18 11:49:05 -0700
commit469c38e9fb91bf383e92fd697eceb07f30316030 (patch)
tree34f945f67fdc7ce3107cd4c17e9616b89972e2eb /test
parent4b6f54d063c33e13ced7d6dd5208921680f56ca6 (diff)
downloadswift-469c38e9fb91bf383e92fd697eceb07f30316030.tar.gz
wsgi: Add keepalive_timeout option
Clients sometimes hold open connections "just in case" they might later pipeline requests. This can cause issues for proxies, especially if operators restrict max_clients in an effort to improve response times for the requests that *do* get serviced. Add a new keepalive_timeout option to give proxies a way to drop these established-but-idle connections without impacting active connections (as may happen when reducing client_timeout). Note that this requires eventlet 0.33.4 or later. Change-Id: Ib5bb84fa3f8a4b9c062d58c8d3689e7030d9feb3
Diffstat (limited to 'test')
-rw-r--r--test/unit/common/test_wsgi.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/unit/common/test_wsgi.py b/test/unit/common/test_wsgi.py
index 5cddc7164..e3f988452 100644
--- a/test/unit/common/test_wsgi.py
+++ b/test/unit/common/test_wsgi.py
@@ -496,6 +496,7 @@ class TestWSGI(unittest.TestCase):
config = """
[DEFAULT]
client_timeout = 30
+ keepalive_timeout = 10
max_clients = 1000
swift_dir = TEMPDIR
@@ -535,6 +536,7 @@ class TestWSGI(unittest.TestCase):
self.assertTrue('custom_pool' in kwargs)
self.assertEqual(1000, kwargs['custom_pool'].size)
self.assertEqual(30, kwargs['socket_timeout'])
+ self.assertEqual(10, kwargs['keepalive'])
proto_class = kwargs['protocol']
self.assertEqual(proto_class, wsgi.SwiftHttpProtocol)
@@ -585,6 +587,7 @@ class TestWSGI(unittest.TestCase):
self.assertTrue('custom_pool' in kwargs)
self.assertEqual(10, kwargs['custom_pool'].size)
self.assertEqual(2.5, kwargs['socket_timeout'])
+ self.assertNotIn('keepalive', kwargs) # eventlet defaults to True
proto_class = kwargs['protocol']
self.assertEqual(proto_class, wsgi.SwiftHttpProxiedProtocol)
@@ -594,6 +597,7 @@ class TestWSGI(unittest.TestCase):
config = """
[DEFAULT]
swift_dir = TEMPDIR
+ keepalive_timeout = 0
[pipeline:main]
pipeline = proxy-server
@@ -623,6 +627,7 @@ class TestWSGI(unittest.TestCase):
self.assertTrue('protocol' in kwargs)
self.assertEqual('HTTP/1.0',
kwargs['protocol'].default_request_version)
+ self.assertIs(False, kwargs['keepalive'])
def test_run_server_conf_dir(self):
config_dir = {