Add an option to reuse connections
While using requests.session TCP connections are reused. OVN Load Balancing algorithm uses hash with source port to route clients requests. In that terms if connection is reused the load is not spread across members. This patch adds an option to disable reusing connections. Change-Id: I61a202a2c1a6d15d714464d519de39f5f2acb2a6 Story: 2006264 Task: 35992
This commit is contained in:
parent
4738618817
commit
6a508ce44a
|
@ -184,6 +184,9 @@ OctaviaGroup = [
|
|||
cfg.StrOpt('availability_zone',
|
||||
default=None,
|
||||
help='Availability zone to use for creating servers.'),
|
||||
cfg.BoolOpt('test_reuse_connection', default=True,
|
||||
help='Reuse TCP connections while testing LB with '
|
||||
'HTTP members (keep-alive).'),
|
||||
]
|
||||
|
||||
lb_feature_enabled_group = cfg.OptGroup(name='loadbalancer-feature-enabled',
|
||||
|
|
|
@ -862,7 +862,9 @@ class LoadBalancerBaseTestWithCompute(LoadBalancerBaseTest):
|
|||
|
||||
def check_members_balanced(self, vip_address, traffic_member_count=2,
|
||||
protocol='http', verify=True):
|
||||
session = requests.Session()
|
||||
handler = requests
|
||||
if CONF.load_balancer.test_reuse_connection:
|
||||
handler = requests.Session()
|
||||
response_counts = {}
|
||||
|
||||
if ipaddress.ip_address(vip_address).version == 6:
|
||||
|
@ -873,7 +875,7 @@ class LoadBalancerBaseTestWithCompute(LoadBalancerBaseTest):
|
|||
# Send a number requests to lb vip
|
||||
for i in range(20):
|
||||
try:
|
||||
r = session.get('{0}://{1}'.format(protocol, vip_address),
|
||||
r = handler.get('{0}://{1}'.format(protocol, vip_address),
|
||||
timeout=2, verify=verify)
|
||||
|
||||
if r.content in response_counts:
|
||||
|
|
Loading…
Reference in New Issue