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

Query size of single thread executor in NonBlockingStatsDClient #16

Open
JensRantil opened this issue Jun 3, 2014 · 5 comments
Open

Comments

@JensRantil
Copy link

For a lot of metrics, it's is crucial to also monitor the size of the queue in the executor in NonBlockingStatsDClient. I propose opening up to supply a custom executor to the constructor. I think that's the most flexible solution. That said, is NonBlockingStatsDClient#clientSocket(...) thread safe?

@scarytom
Copy link
Contributor

Ultimately, this depends on http://docs.oracle.com/javase/7/docs/api/java/net/DatagramSocket.html#send(java.net.DatagramPacket) being thread safe, which, as far as I can ascertain, it is.

I'll have a look at introducing some more flexibility around the Executor in a forthcoming release, but I'm working on the other bugs and feature requests first.

In the meantime, I'd be interested in the techniques you employ to monitor the size of an executor queue.

@JensRantil
Copy link
Author

Currently not using statsd-client in production, but we do monitor BlockingQueue size of Executors. The way we do this is by manually instantiating and supplying a BlockingQueue to our Executor implementation. We then periodically poll the size of the queue. This obviously does not monitor the number of running threads (that have been polled off the queue), which is another thing we monitor separately.

@scarytom
Copy link
Contributor

Thanks for the information -- it seems likely that I could change the statsd-client to take ownership of its own work queue in the way you describe, and to provide a way of monitoring the length of that queue. As, in the current implementation, there is only ever one running thread, monitoring that would not be necessary.

I'm going to think more on this before making any changes.

@JensRantil
Copy link
Author

👍

@krishna81m
Copy link

Do you expect us to write threadlocal implementations to return the same StatsDClient per thread, remove() after request is processed or it is already done internally?

How do we monitor the BlockingQueue size? Why is it called NonBlocking then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants