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

Add async 3.x metric servlets #1123

Closed
mattrjacobs opened this issue Mar 8, 2016 · 5 comments
Closed

Add async 3.x metric servlets #1123

mattrjacobs opened this issue Mar 8, 2016 · 5 comments

Comments

@mattrjacobs
Copy link
Contributor

As mentioned by @agentgt in #1117 (comment), using async servlets is more appropriate for server-push streams like these metric streams.

Not everyone might be able to use these, so the blocking servlets should stick around to not break backwards-incompatibility.

@fcalderonnearsoft
Copy link
Contributor

@mattrjacobs I am interested, can we talk about it?

@mattrjacobs
Copy link
Contributor Author

@fcalderonnearsoft Sure, we can use this comment thread to discuss the implementation. Thanks for your interest - it is much appreciated! @agentgt, please feel free to jump in if you're interested.

I think the main goal should be to add a new servlet implementation that uses the AsyncContext available in Servlet 3+. The current implementation holds a Tomcat thread until the connection is closed from the outside. The Tomcat thread is basically doing an infinite loop which wakes up every so often to grab the current set of metrics and put them in the HttpResponse.

Using the async features should mean that receiving the HTTP GET results in a timer getting created (Observable.interval might be a good choice here). That's all that happens on the Tomcat thread, which is then freed. The timer executes work which closes over the AsyncContext and gives the AsyncContext the current set of metric values every time it ticks.

This is what I gathered from reading about Servlet 3.x features. I'm excited to see how this fits together, and would love any corrections to my description of the work to do.

@agentgt
Copy link
Contributor

agentgt commented Mar 17, 2016

Its been a while since I have used Servlet 3.0 directly (I have used wrapping libraries) but if no one picks it up I'll look into it.

We don't use the Hystrix dashboard (we use codahale metrics) so I'm probably not the best one to test this functionality.

@fcalderonnearsoft
Copy link
Contributor

@mattrjacobs I liked your idea, I am not a expert on Servlet 3.0 but I will look into it.

@agentgt If you decide to participate I would like to help you.

@mattrjacobs
Copy link
Contributor Author

Closing due to inactivity

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