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 admin API to kill running queries #290

Closed
pjeli opened this issue Dec 10, 2019 · 2 comments · Fixed by #291
Closed

Add admin API to kill running queries #290

pjeli opened this issue Dec 10, 2019 · 2 comments · Fixed by #291
Labels
enhancement New feature or request

Comments

@pjeli
Copy link
Collaborator

pjeli commented Dec 10, 2019

Seen instances where an NNA instance can get locked up from running expensive queries. Would be nice to interrupt the requests and get back to stable state.

This issue is to try to make that possible.

@pjeli pjeli added the enhancement New feature or request label Jan 2, 2020
@pjeli
Copy link
Collaborator Author

pjeli commented Jan 2, 2020

So there isn't exactly an easy way to stop queries but we can put in a safe guard that will only let the current running query finish and then cancel all others after. That should work for now. Otherwise we'd have to shut down the ForkJoinPool and then restore it somehow - seems too catastrophic for the application.

pjeli added a commit to pjeli/NNAnalytics that referenced this issue Jan 2, 2020
pjeli added a commit to pjeli/NNAnalytics that referenced this issue Jan 2, 2020
pjeli added a commit to pjeli/NNAnalytics that referenced this issue Jan 2, 2020
@pjeli pjeli closed this as completed in #291 Jan 3, 2020
@pjeli
Copy link
Collaborator Author

pjeli commented Jan 3, 2020

Just some confirmation on how this works. There is now a /queryGuard endpoint. When you hit the endpoint with an HTTP GET call you will either enter the guard mode or drop it.

You can always check /info to see if you are guarding or not.

If you are in guard mode, then no other queries except the one that is currently running (prior to entering guard mode) will run. Anything queue'd up will fail instantly with an Exception saying "Query cancelled.".

If you are not in guard mode then all queries will continue to process in NNA as usual.

Guard mode does not stop the SuggestionsEngine - it will continue to process in the background as usual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant