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

Element-R: "Migrate to rust" labs button #26678

Closed
7 tasks done
richvdh opened this issue Nov 30, 2023 · 3 comments
Closed
7 tasks done

Element-R: "Migrate to rust" labs button #26678

richvdh opened this issue Nov 30, 2023 · 3 comments
Assignees
Labels
A-Element-R Issues affecting the port of Element's crypto layer to Rust customer-retainer T-Enhancement T-Epic Issue is at Epic level Z-Labs

Comments

@richvdh
Copy link
Member

richvdh commented Nov 30, 2023

At some point we will need to start actively migrating people who are using EW sessions on legacy Crypto to Rust crypto.

We will need a migration process for this. To gain confidence in the migration, we will add some sort of "developer feature" where people can request a migration. Later, we will automate the migration.

Tasks

  1. richvdh
  2. A-Element-R Z-Labs
    richvdh
  3. A-Element-R Z-Labs
    richvdh
  4. A-Element-R T-Enhancement Z-Labs
    richvdh
  5. A-Element-R T-Enhancement Z-Labs
    richvdh
  6. A-Element-R O-Uncommon S-Major T-Defect Z-Element-R-Blocker Z-Labs
    richvdh
  7. A-Element-R T-Enhancement Z-Element-R-Blocker Z-Labs
    richvdh
@richvdh richvdh changed the title "Migrate to rust" labs button Element-R: "Migrate to rust" labs button Nov 30, 2023
@MidhunSureshR MidhunSureshR added T-Enhancement A-Element-R Issues affecting the port of Element's crypto layer to Rust labels Dec 1, 2023
@github-actions github-actions bot added the Z-Labs label Dec 1, 2023
@richvdh
Copy link
Member Author

richvdh commented Dec 4, 2023

UX for this will be a labs button that causes the session to be restarted when it is enabled.

We probably need some sort of modal that indicates the state of the migration.

@richvdh richvdh self-assigned this Dec 11, 2023
@richvdh

This comment was marked as resolved.

@richvdh
Copy link
Member Author

richvdh commented Jan 8, 2024

Looking at the performance of this as it stands:

On a test database containing 37 olm sessions and 4810 megolm sessions:

  • 10.181s: migration start: counting the sessions to be imported
  • 10.202s: start importing base data
  • 10.267s: start importing olm sessions
  • 10.363s: start importing megolm sessions
  • 22.843s: migration complete

Obviously, that is dominated by the megolm session import, at 12.5s for 4810 sessions, or ~130ms for each batch of 50 sessions. The actual time for each batch is quite variable, but there are three stages:

  • Read a batch of sessions from the legacy db. Average time: 19.0ms
  • Save batch to new db. Average time: 34.1ms
  • Delete the batch from the legacy db. Average time: 77.3ms.

Somewhat unexpected that deleting things from the old db is what takes the time. We could reduce it to (empirically) about 54.9ms by iterating through the store looking for rows to delete instead of using the index (which works because we know the batch will be at the "start" of the store); or we could rewrite the whole thing to store the progress made so far and delete everything on a single batch at the end. Not sure it is worthwhile though. If we need it to go faster, we can do it in the background.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Element-R Issues affecting the port of Element's crypto layer to Rust customer-retainer T-Enhancement T-Epic Issue is at Epic level Z-Labs
Projects
None yet
Development

No branches or pull requests

2 participants