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

The more workspaces, the slower they are to appear in GUI on startup #1619

Closed
touilleMan opened this issue Jan 4, 2021 · 0 comments · Fixed by #1621
Closed

The more workspaces, the slower they are to appear in GUI on startup #1619

touilleMan opened this issue Jan 4, 2021 · 0 comments · Fixed by #1621
Assignees
Labels
C-GUI Category: Graphical User Interface issue enhancement Improve functionality, potentially changing behavior
Projects

Comments

@touilleMan
Copy link
Member

with Parsec v2.2.2:

> /home/emmanuel/projects/parsec-cloud2/parsec/core/remote_devices_manager.py(148)get_user_and_devices()
-> rep = await self._backend_cmds.user_get(user_id)
(Pdb) up
> /home/emmanuel/projects/parsec-cloud2/parsec/core/remote_devices_manager.py(96)get_user()
-> verified_user, verified_revoked_user, _ = await self.get_user_and_devices(
(Pdb) 
> /home/emmanuel/projects/parsec-cloud2/parsec/core/fs/remote_loader.py(235)get_user()
-> return await self.remote_devices_manager.get_user(user_id, no_cache=no_cache)
(Pdb) 
> /home/emmanuel/projects/parsec-cloud2/parsec/core/fs/workspacefs/workspacefs.py(209)get_reencryption_need()
-> _, revoked_user = await self.remote_loader.get_user(user_id, no_cache=True)
(Pdb) 
> /home/emmanuel/projects/parsec-cloud2/parsec/core/gui/workspaces_widget.py(135)_add_workspacefs()
-> reenc_needs = await workspace_fs.get_reencryption_need()

GUI's workspace widgets check for reencryption needs each time when created.
However reencryption needs check doesn't use cache (otherwise a recently revoked user would not be detected as a reencryption need).
This lead to 2 + N requests (with N the number of user that currently have a role in the workspace) to the backend for each workspaces to:

  • get realm status (to make sure the realm is not already beeing reencrypted)
  • get realm role certificates (single request to the backend gets us all the certificates)
  • get user revoked certificate for each member

The bad part is the GUI doesn't display the widget until the check is done, and no cache means this is growing linearly with the number of workspaces :'-(

To solve this, the simplest solution would be to make this reencryption need check asynchronous in the GUI (so first display all the workspaces, run the check in the background, then finally add the "reencryption needed" warning where needed)

Another potential quick win would be to do this check only when the current user is owner of the workspace (given only there her can proceed to the reencryption). Currently the check is done for everybody (so everybody is see that the workspace need reencryption... not sure if it's a good or a bad thing) but clicking on the reencrypt button pop a dialog explaining only owner can do that.

However this is not 100% perfect given it doesn't solve the « (2 + N) * W requests to the backend each time the workspaces widget page is loaded » which seems a bit overkill for a check that is very rarely needed.
On top of that, that greedy check doesn't protect us against a malicious backend that wants to lie by omision (hence hiding us the fact that a revocation certificate has been issued toward a given user).
So I think in the long run it migh be worth it to rework the cache system (for instance caching all the user/device/role certifications involved in a workspace once, then listening for backend events to update them)

@touilleMan touilleMan added enhancement Improve functionality, potentially changing behavior C-GUI Category: Graphical User Interface issue labels Jan 4, 2021
@touilleMan touilleMan added this to New comers in Dev Board via automation Jan 4, 2021
@touilleMan touilleMan moved this from New comers to Investigate in Dev Board Jan 6, 2021
@touilleMan touilleMan moved this from Investigate to Doing in Dev Board Jan 6, 2021
@touilleMan touilleMan moved this from Doing to Done in Dev Board Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-GUI Category: Graphical User Interface issue enhancement Improve functionality, potentially changing behavior
Projects
No open projects
Dev Board
To review
Development

Successfully merging a pull request may close this issue.

2 participants