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

Adding TCP interface would enable more reliable repeater use across unreliable links #204

Closed
timbunce opened this issue Dec 8, 2012 · 10 comments

Comments

@timbunce
Copy link
Contributor

timbunce commented Dec 8, 2012

UDP fire-and-forget makes perfect sense for the app->statsd link when statsd runs on localhost. In many circumstances it's also fine when statsd runs on a remote host with a reliable link.

But where there's a risk of packet loss is high and the stats are important it would be good to have a more reliable transport.

For this use-case I envisage using UDP for the app -> statsd on localhost link. That statsd would then use the repeater backend to forward the stats via TCP, to a central statsd aggregating stats from many hosts.

@mrtazz
Copy link
Member

mrtazz commented Dec 9, 2012

Couldn't the central StatsD run within the "reliable" network then? I take it that normally not all network connectivity goes drastically downhill outside of localhost. Since we're already using TCP based communication for a lot of the backend flushing (like Graphite for example) that could be leveraged to place the more reliable communication on the more unreliable link. I'm not completely opposed to a TCP option, but I also don't know if this is a serious enough problem to warrant making StatsD way more complex (what protocol are which instances running? should we combine multiple metrics in a packet or repeat directly? How would we handle connection errors?).

@timbunce
Copy link
Contributor Author

I'd suggest having TCP metric input as an option (default off). That much should be very simple.

The next step would be to enable the repeater to use a tcp connection (default off). Probably also simple.

I'd keep it simple: just repeat metrics directly because tcp will look after putting them on the wire efficiently. (Someone else could write a more advanced buffering backend if they want. I don't see much need.)

Similarly, failure to connect would just keep retrying, and blocking on write would hang the local statsd. Both simple and reasonable behaviours because if the remote statsd or link was down the udp data would be lost anyway.

@abh
Copy link

abh commented Mar 13, 2013

A variation of "tcp" would be to have it support HTTP; with keepalive or even websockets it wouldn't necessarily be terribly inefficient. It'd make it easier to fit into odd infrastructures.

@mrtazz
Copy link
Member

mrtazz commented Mar 16, 2013

Yes, we are planning to adapt the StatsD internals a bit to make it easier to have different ways of connecting to it.

@rkb9572
Copy link

rkb9572 commented Jun 17, 2013

+1 for TCP. Great work though!

@OferE
Copy link

OferE commented Aug 14, 2013

+1

1 similar comment
@macio
Copy link

macio commented Oct 25, 2013

+1

@flocsy
Copy link

flocsy commented Mar 28, 2014

any update on the TCP feature?

@atulatri
Copy link

+1
Lets make it open source alternative of newrelic.

@benburry
Copy link
Contributor

#448 adds a tcp interface to statsd. To use it, set the server configuration variable to "./servers/tcp"

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

No branches or pull requests

9 participants