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

[Monitoring] Stop a new request when one is inflight #27253

Merged

Conversation

chrisronline
Copy link
Contributor

@chrisronline chrisronline commented Dec 14, 2018

Resolves #24082

This PR adds code to prevent an additional API request if there is one in-flight. However, in order to make this work properly for all monitoring UI pages, we need to update the legacy ones to properly use the base controller. This PR includes that work as well.

Testing

NOTE: This is just how I tested it and feel free to find another way if this doesn't work for you.

  1. Go to any page in the monitoring UI
  2. Change the refresh interval rate to 5 seconds:

screen shot 2018-12-17 at 12 18 40 pm

3) In the URL address bar, change the interval to 1s (or 1000ms):

screen shot 2018-12-17 at 12 19 37 pm

4) In the browser dev tools, turn on throttling:

screen shot 2018-12-17 at 12 21 41 pm

  1. Watch the network tab to ensure a request is fired only once every 1s (and you can also verify the requests are taking longer than 1s each):

screen shot 2018-12-17 at 12 22 21 pm

@elasticmachine
Copy link
Contributor

Pinging @elastic/stack-monitoring

@pickypg
Copy link
Member

pickypg commented Dec 14, 2018

Could you possibly split this so that the Logstash monitoring UI changes are in a separate PR? It looks like the meat of the core change here is quite small.

@elasticmachine
Copy link
Contributor

💔 Build Failed

@chrisronline
Copy link
Contributor Author

@pickypg Done!

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@chrisronline
Copy link
Contributor Author

retest

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@pickypg pickypg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm most concerned about base_controller.js's updates. And those LGTM, but I think could be improved a little.

this.updateData = () => {
if (this.updatingData) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could simplify this and remove this.updatingData altogether by simply checking this.updateDataPromise, then just set this.updateDataPromise = null;, which we should probably do regardless, instead of this.updatingData = false;.

@chrisronline
Copy link
Contributor Author

@pickypg Updated!

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Member

@pickypg pickypg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@chrisronline chrisronline merged commit faa57fd into elastic:master Dec 17, 2018
@chrisronline chrisronline deleted the monitoring/one_request_at_a_time branch December 17, 2018 20:09
chrisronline added a commit to chrisronline/kibana that referenced this pull request Dec 17, 2018
* Convert all pages to use the base controlller, then add logic in there to stop a new request when one is inflight

* Reuse the promise

* Undo logstash changes

* Update in catch too

* Add unit test

* Fix cluster name showing up

* Update broken test

* Just use updateDataPromise
chrisronline added a commit that referenced this pull request Dec 17, 2018
* Convert all pages to use the base controlller, then add logic in there to stop a new request when one is inflight

* Reuse the promise

* Undo logstash changes

* Update in catch too

* Add unit test

* Fix cluster name showing up

* Update broken test

* Just use updateDataPromise
@chrisronline
Copy link
Contributor Author

Backport:

6.x: 6d2b61f

@marius-dr
Copy link
Member

Nice improvement for "Killbana" mitigation. ++

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

Successfully merging this pull request may close these issues.

4 participants