mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-22 09:32:21 +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:
parent
2d906e1886
commit
6e4d9d9eb4
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user