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

perf: improve ProteusClientCoreCrypto performance [WPB-10000] #2974

Merged
merged 4 commits into from
Sep 2, 2024

Conversation

vitorhugods
Copy link
Member

@vitorhugods vitorhugods commented Aug 28, 2024

SpikeWPB-10000 [Android] Investigate the text last read event handling bottleneck and spickes


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

We're a bit slow to process events.

Causes

In part, it's nature of E2EE. In part, we are not really being optimal.

In the generic sense, we can improve Proteus/CoreCrypto performance by not saving session (which is unnecessary, as CoreCrypto already does it during decryption), and also avoid checking if the session exists over and over again if we already know it exists.

Solutions

  1. Remove the "saveSession" bit of ProteusClientCoreCrypto.
  2. Cache known sessions in-memory and check that instead of relying only on CoreCrypto, which uses IO in order to do that

Document my findings in this notebook.


PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@vitorhugods vitorhugods requested review from typfel, a team, yamilmedina, borichellow, MohamadJaara and saleniuk and removed request for a team August 28, 2024 12:21
@echoes-hq echoes-hq bot added the echoes: maintenance Maintenance activity - Refactoring , Preventive , Improvements to code , Performance improvements label Aug 28, 2024
@vitorhugods vitorhugods force-pushed the perf/improve-event-processing-speed branch from 9f26e52 to 5f1b388 Compare August 28, 2024 12:28
Copy link
Contributor

github-actions bot commented Aug 28, 2024

Test Results

3 193 tests  ±0   3 088 ✔️ ±0   3m 39s ⏱️ +2s
   548 suites ±0      105 💤 ±0 
   548 files   ±0          0 ±0 

Results for commit 7c291a0. ± Comparison against base commit 938fee7.

♻️ This comment has been updated with latest results.

@datadog-wireapp
Copy link

datadog-wireapp bot commented Aug 28, 2024

Datadog Report

Branch report: perf/improve-event-processing-speed
Commit report: 16dff6a
Test service: kalium-jvm

✅ 0 Failed, 3088 Passed, 105 Skipped, 12.86s Total Time

Copy link
Member

@MohamadJaara MohamadJaara left a comment

Choose a reason for hiding this comment

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

this change is a nice candidate for a ADR, just saying it does not need to be the whole notebook, but maybe small description with a link to the notebook

Copy link
Contributor

@yamilmedina yamilmedina left a comment

Choose a reason for hiding this comment

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

Great work and nice introduction of these notebooks
Just left one suggestion/question about naming and breaking patterns.

Also agree with Mo, this is a good candidate for an ADR, maybe for a next PR 🤔

Notebooks/README.md Outdated Show resolved Hide resolved
@vitorhugods
Copy link
Member Author

Great work and nice introduction of these notebooks Just left one suggestion/question about naming and breaking patterns.

Also agree with Mo, this is a good candidate for an ADR, maybe for a next PR 🤔

About ADRs... do we have ADRs on Kalium as well? Because this was the main reason that made me not do it. I am starting to think we should merge the repos more and more.


I just did Notebooks instead of notebooks because it is indeed different from the rest. Maybe docs would be better. I'll rename it to something like that.

Copy link

sonarcloud bot commented Sep 2, 2024

@yamilmedina yamilmedina self-requested a review September 2, 2024 08:34
@MohamadJaara MohamadJaara added this pull request to the merge queue Sep 2, 2024
Merged via the queue into release/candidate with commit b12a05b Sep 2, 2024
22 checks passed
@MohamadJaara MohamadJaara deleted the perf/improve-event-processing-speed branch September 2, 2024 10:37
github-actions bot pushed a commit that referenced this pull request Sep 2, 2024
* perf: improve ProteusClientCoreCrypto performance

* docs: fix typos

* chore: move notebooks to docs/notebooks
github-merge-queue bot pushed a commit that referenced this pull request Sep 5, 2024
…#2985)

* perf: improve ProteusClientCoreCrypto performance

* docs: fix typos

* chore: move notebooks to docs/notebooks

Co-authored-by: Vitor Hugo Schwaab <[email protected]>
Co-authored-by: Mohamad Jaara <[email protected]>
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
echoes: maintenance Maintenance activity - Refactoring , Preventive , Improvements to code , Performance improvements 👕 size: XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants