Skip to content

Conversation

@bmd3k
Copy link
Contributor

@bmd3k bmd3k commented Apr 9, 2020

Note that this is the ng_tensorboard version of #3483.

  • Motivation for features / changes
    Reduce the load on TensorBoard servers by disabling auto reload if the page is not considered visible.

  • Technical description of changes
    Do not auto reload if document is not visible according to the Page
    Visibility API. When page again becomes visible perform an auto reload
    if one has been missed.

  • Detailed steps to verify changes work correctly (as executed by you)
    Run a local TensorBoard.
    Open localhost:6006.
    Ensure option "Reload data" is selected and choose a 15s "Reload Period".
    Open detached network tab in chrome developer tools.
    Watch for several minutes and observe that many network calls are made every 15s.
    Open different tab in same window but with chrome developer tools still visible.
    Watch for several minutes and observe that no network calls are made.
    Switch back to TensorBoard tab and watch as network calls are immediately made and UI reloads graphs.
    Continue to watch network tab as it again follows a 15s period for reload network calls.

@bmd3k bmd3k changed the title Disable auto reload when page is not visible in ng_tensorboard. Disable auto reload if page is not visible in ng_tensorboard Apr 9, 2020
@bmd3k bmd3k marked this pull request as ready for review April 9, 2020 14:23
@bmd3k bmd3k requested a review from stephanwlee April 9, 2020 14:23
@bmd3k bmd3k requested a review from stephanwlee April 10, 2020 17:19
constructor(private store: Store<State>) {}
constructor(
private store: Store<State>,
@Inject(DOCUMENT) private document: Document
Copy link
Contributor

Choose a reason for hiding this comment

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

private readonly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

* document is readonly property in ReloaderComponent
* fakeDocument is created for each test run
@bmd3k bmd3k requested a review from stephanwlee April 13, 2020 14:54
Copy link
Contributor

@stephanwlee stephanwlee left a comment

Choose a reason for hiding this comment

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

Still LGTM.

declarations: [ReloaderComponent],
}).compileComponents();
store = TestBed.get(Store);
fakeDocument = TestBed.get(DOCUMENT);
Copy link
Contributor

Choose a reason for hiding this comment

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

just wondering, what happens if you change this to TestBed.get(DOCUMENT) as typeof document?
I want to avoid any where possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

typeof document doesn't seem to help. I can (and have) made fakeDocument: Document but it requires some slight grossness to override the visibilityState property. That's ok - I think the grossness is outweighed by the better typing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Acknowledged.

@bmd3k bmd3k merged commit 2a8a863 into tensorflow:master Apr 15, 2020
@bmd3k bmd3k deleted the autoreload-reduce-ng branch April 20, 2020 12:24
caisq pushed a commit to caisq/tensorboard that referenced this pull request May 19, 2020
…low#3498)

Note that this is the ng_tensorboard version of tensorflow#3483.

* Motivation for features / changes
Reduce the load on TensorBoard servers by disabling auto reload if the page is not considered visible.

* Technical description of changes
Do not auto reload if document is not visible according to the Page
Visibility API. When page again becomes visible perform an auto reload
if one has been missed.
caisq pushed a commit that referenced this pull request May 27, 2020
Note that this is the ng_tensorboard version of #3483.

* Motivation for features / changes
Reduce the load on TensorBoard servers by disabling auto reload if the page is not considered visible.

* Technical description of changes
Do not auto reload if document is not visible according to the Page
Visibility API. When page again becomes visible perform an auto reload
if one has been missed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants