Comments (4)
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.
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.
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.
@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)
- Gauge support HOT 3
- Send data with specific timestamp HOT 1
- add support for batching HOT 9
- UDPSocket usage floods connections HOT 9
- UDPSockets leaked under load HOT 37
- sample_rate should only be supported for counters. HOT 6
- Add a wiki page for ruby-statsd extensions / libraries HOT 1
- Add changelog HOT 3
- Statsd#time not resilient to exceptions
- Stats with sample rates < 1 are being sent randomly? HOT 1
- multiple calls to Statsd.new doesn't recreate socket, address family conflicts HOT 1
- Drop 1.8.7 support HOT 1
- Arbitrary metric name parsing HOT 1
- Support sending data over TCP HOT 1
- Proposal to cut a new release HOT 4
- Needs new maintainer HOT 15
- Minimum RubyGems Version HOT 6
- Fix the build! HOT 2
- Newline is missing at the end of the metric thus breaking TCP support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from statsd.