reinh/statsd — pull request #45 by ossareh (2013-08-06 07:22:15+00:00)
Title: Resolve hostname once

Hey,

I'm not entirely sure why you do not resolve the hostname once in your branch, given we just had a production issue related to this decision I figured it a reasonable idea to supply a patch that caches the resolved address. Is the concerns that the IP address of the host may change?

Making this change has a slight performance increase (a few ms per request according to http://matt.aimonetti.net/posts/2013/06/26/practical-guide-to-graphite-monitoring/ ) - it also stops busy sites like ours crippling our DNS server when under load. We could, as you suggest, run a caching dns server on each of our app servers - but that seems like a poor tradeoff when the library could do it so easily.

As an aside, this brings it inline with the python statsd client too: https://github.com/jsocol/pystatsd/blob/master/statsd/client.py#L42