Giter Site home page Giter Site logo

DNS bottleneck about statsd HOT 4 CLOSED

reinh avatar reinh commented on August 16, 2024
DNS bottleneck

from statsd.

Comments (4)

reinh avatar reinh commented on August 16, 2024

That is unfortunate. I may not have much control over DNS resolution but I will look into it. You could of course use an IP instead of a hostname.

from statsd.

mdp avatar mdp commented on August 16, 2024

You could also do this in the library with something along the lines of:

def initialize(host, port)
  unless host.match(/^[^a-zA-Z].+$/)
    host = Resolv.getaddress(host)
  end

from statsd.

ktheory avatar ktheory commented on August 16, 2024

This patch turns statsd into a badly behaving DNS client.

If the DNS of the hostname changes to a different IP address, one expects clients to pick up the change within the TTL. This patch seems to cache DNS for the lifetime of the process.

OTOH, I'm not observing that "DNS service is queried once per sent packet". In ruby 1.8.7 on OS X Lion, DNS works as expected: the first sent stat is slow, and subsequent stats are much faster for the duration of the TTL:

irb -rstatsd -rbenchmark
irb(main):001:0> Benchmark.realtime { Statsd.new("google.com").increment("foo") }
=> 0.0229549407958984 # Slow for DNS
irb(main):002:0> Benchmark.realtime { Statsd.new("google.com").increment("foo") }
=> 0.000710964202880859 # Too fast for a DNS request

Edit June 22 2014 0.00071 seconds (0.7ms) is not too fast for a DNS request. 🐳

from statsd.

jeremy avatar jeremy commented on August 16, 2024

@ktheory indeed - pragmatic attempt to speed up the common case where DNS never changes, but this shouldn't be the client's job. I'll revert.

from statsd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.