itwinjs-core icon indicating copy to clipboard operation
itwinjs-core copied to clipboard

Add performance monitors to core

Open aruniverse opened this issue 2 years ago • 5 comments

In the iTwin Viewer v2.x we added the following metrics to track performance and logged them to the browser's performance timeline

  • Duration of startup to the initialization of iTwin.js services
  • Duration of startup to the establishment of a connection to the iModel
  • Duration of startup to the creation of a view state for the iModel
  • Duration of startup until the last tile is loaded and rendered for the initial iModel view

We want to move this monitoring into core so applications that do not rely on the Viewer component can instrument their's with the same metrics for a better comparison of what their performance should look like.

See related prs in the viewer:

  • https://github.com/iTwin/viewer/pull/86
  • https://github.com/iTwin/viewer/pull/123

https://web.dev/user-timings/

aruniverse avatar Aug 17 '22 15:08 aruniverse

Please do not add any assumptions to packages like core-frontend like "there is exactly one iModel", "there is exactly one viewport", "iModel is being opened from hub", etc.

pmconne avatar Aug 17 '22 16:08 pmconne

Agreed, I anticipate there will be a timing for each of these discrete events and some may have multiple happening at the same time. Though, there are cases where there will be a single fixed time such as IModelApp.startup since it should only happen once within a session.

@aruniverse on this metric, "duration of startup until the last tile is loaded and rendered for the initial iModel view", I'm not sure if we can ever accurately track (or even really need) to track when all tiles are loaded in a given view. Did you mean to say first tile loaded rather than last?

calebmshafer avatar Aug 17 '22 16:08 calebmshafer

IModelApp.startup since it should only happen once within a session.

I seem to recall the Synchro team (used to?) shut down and restart IModelApp under certain circumstances.

pmconne avatar Aug 17 '22 16:08 pmconne

@aruniverse on this metric, "duration of startup until the last tile is loaded and rendered for the initial iModel view", I'm not sure if we can ever accurately track (or even really need) to track when all tiles are loaded in a given view. Did you mean to say first tile loaded rather than last?

Yea this one we need to rethink how we want to handle this. We captured this event in ViewCreator3d.createDefaultViewState or at the app level if they didnt use the default view state.

This metric can be undefined under real usage if the user never stops moving around in the vp, but for testing purposes I'd hope we would always be able to track when all tiles are loaded.

I don't know if the way we've currently been tracking time to first tile is accurate yet, but yea we can add that metric to track as well.

aruniverse avatar Aug 17 '22 16:08 aruniverse

move to 3.5

calebmshafer avatar Sep 12 '22 13:09 calebmshafer