2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-25 11:01:09 +00:00

Address potential slowdowns by misbehaving DNS

For one, shorten the DNS timeout, if the DNS server is completely out, give up quickly.

For another, if a host has a large number of net.X.hostnames, the sequential nature
was intolerable.
Have each network be evaluated in a greenthread concurrently to serve
the DNS latency concurrently.
This commit is contained in:
Jarrod Johnson 2023-10-12 14:46:09 -04:00
parent 2d906e1886
commit 6e4d9d9eb4

View File

@ -25,6 +25,9 @@ import eventlet.support.greendns
import os
getaddrinfo = eventlet.support.greendns.getaddrinfo
eventlet.support.greendns.resolver.clear()
eventlet.support.greendns.resolver._resolver.lifetime = 1
def msg_align(len):
return (len + 3) & ~3
@ -333,11 +336,13 @@ def get_full_net_config(configmanager, node, serverip=None):
myaddrs = get_addresses_by_serverip(serverip)
nm = NetManager(myaddrs, node, configmanager)
defaultnic = {}
ppool = eventlet.greenpool.GreenPool(64)
if None in attribs:
nm.process_attribs(None, attribs[None])
ppool.spawn(nm.process_attribs, None, attribs[None])
del attribs[None]
for netname in sorted(attribs):
nm.process_attribs(netname, attribs[netname])
ppool.spawn(nm.process_attribs, netname, attribs[netname])
ppool.waitall()
retattrs = {}
if None in nm.myattribs:
retattrs['default'] = nm.myattribs[None]