Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimize DNS resolution queries on grains load #29346

Merged
merged 1 commit into from
Dec 2, 2015

Conversation

adelcast
Copy link
Contributor

@adelcast adelcast commented Dec 2, 2015

When grains are loaded, hostname() is called multiple times. The
hostname() function ends up calling socket.getfqdn, which is an
expensive operation if the host is not on the domain (the function times
out). Optimize grains operation to only query getfqdn once. Also , optimize
fqdn_ip4 and fqdn_ipv6 grains to only call socket.getaddrinfo (expensive
operation) if there is a domain.

Signed-off-by: Alejandro del Castillo alejandro.delcastillo@ni.com

When grains are loaded, hostname() is called multiple times. The
hostname() function ends up calling socket.getfqdn, which is an
expensive operation if the host is not on the domain (the function times
out). Optimize grains operation to only query getfqdn once. Also , optimize
fqdn_ip4 and fqdn_ipv6 grains to only call socket.getaddrinfo (expensive
operation) if there is a domain.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
@cachedout
Copy link
Contributor

This is an excellent addition and should also optimize the use of salt-call substantially. Great job, @adelcast

cachedout pushed a commit that referenced this pull request Dec 2, 2015
Minimize DNS resolution queries on grains load
@cachedout cachedout merged commit f5e2487 into saltstack:develop Dec 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants