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

Improve connection speed/reliability and add more logging around connections #2542

Open
wants to merge 13 commits into
base: 2.2.0
Choose a base branch
from

Conversation

islathehut
Copy link
Collaborator

@islathehut islathehut commented May 17, 2024

This should make connecting to new peers, especially when opening the app or resuming the app (iOS), noticeably faster with fewer errors when connecting to peers that are online.

  • Wait to dial peers until we know tor is fully bootstrapped
  • Deduplicate tasks in processInChunksService to avoid clutter
  • Reduce the number of parallel dials on libp2p
  • Update some timeouts/ping intervals and use doPX on libp2p connection manager (PX allows peers to share peer information with each other)
  • Add more logging internally and on libp2p packages

Pull Request Checklist

  • I have linked this PR to a related GitHub issue.
  • I have added a description of the change (and Github issue number, if any) to the root CHANGELOG.md.

(Optional) Mobile checklist

Please ensure you completed the following checks if you did any changes to the mobile package:

  • I have run e2e tests for mobile
  • I have updated base screenshots for visual regression tests

@islathehut islathehut changed the base branch from develop to 2.2.0 May 17, 2024 20:32
@islathehut islathehut marked this pull request as ready for review May 17, 2024 20:38
dialTimeout: 120_000,
maxParallelDials: 10,
dialTimeout: 120000,
maxParallelDials,
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this set maxParallelDials to? We observed a while back that too many dials or too many connections could create a performance problem, perhaps only on mobile. I think the performance problem was with Tor if I remember correctly. Maybe that's been fixed in Tor and it's not a problem anymore but we should check to make sure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This PR lowers the max parallel dials from 10 to 2 because it seems to cause issues with connections.

@@ -2,7 +2,7 @@ import { EventEmitter } from 'events'
import fastq, { queueAsPromised } from 'fastq'

import Logger from '../common/logger'
import { randomUUID } from 'crypto'
import CryptoJS from 'crypto-js'
Copy link
Contributor

Choose a reason for hiding this comment

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

This says it's deprecated and not maintained. I think that's a barrier to us using it unless there's something I'm missing? https://www.npmjs.com/package/crypto-js

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was already in the project and I'm only using it to generate a consistent shared ID via hashing, no security threat or anything.

Copy link
Contributor

Choose a reason for hiding this comment

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

And in the other place it's not used for anything security related either?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That I don't know, I haven't checked the usages

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants