Right panel performance fixes #6075
Closed
+20
−40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See https://trello.com/c/vv4mqsAi/5752-omero-omeroweb-on-demo-is-slow
This PR improves the performance of the right-hand metadata panel, particularly for Images and noticeable with large numbers of users in the current group.
Calling
conn.getObjects()
orconn.getObject()
with group context-1
is slow with large numbers of users in the group. We could use the current group of the webclient (session['active_group']
) to set the group context, but it could result in 404 if user has e.g webclient open in 2 browser tabs with a different group in each etc.Instead, this PR reduces the number of times this is called to 1, instead of 3. So it should be 3 x faster.
Also, to avoid the risk of any additional calls to
getObject()
being added in the future, we set the group context once we have loaded the Object and know the group.For example, using
{{ ome.user.id }}
in a template was causinggetObject("Experimenter", id)
to be called. Setting the context improved the speed of this, although I also replaced this with{{ ome.user_id }}
which removes the call entirely.To test functionality (not broken):
To test performance (learning server with large number of users):
I guess if we want to quantify speed improvements, we could time the right panel loading with and without this PR merged?
cc @mtbc, @pwalczysko