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

feat(iroh-relay): send regular pings to check the connection #3113

Merged
merged 7 commits into from
Jan 13, 2025

Conversation

dignifiedquire
Copy link
Contributor

@dignifiedquire dignifiedquire commented Jan 9, 2025

Description

Because of issues with TCP, we now send regular ping-pongs from client to server and vice versa.

Breaking Changes

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

Copy link

github-actions bot commented Jan 9, 2025

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3113/docs/iroh/

Last updated: 2025-01-13T16:17:30Z

Copy link

github-actions bot commented Jan 9, 2025

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: 3046186

@dignifiedquire dignifiedquire marked this pull request as ready for review January 9, 2025 17:34
@@ -623,13 +641,19 @@ impl ActiveRelayActor {
state: &mut ConnectedRelayState,
client_stream: &mut iroh_relay::client::ClientStream,
) -> Result<()> {
const SEND_TIMEOUT: Duration = Duration::from_secs(10); // TODO: what should this be?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

what should this be?

Copy link
Contributor

Choose a reason for hiding this comment

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

contraints are:

  • MAX_PACKET_SIZE is set to 64 KiB
  • The client sends up to 20 packets at once (if this is too annoying we could take out that batching)
  • so worst-case a single send is 200 KiB
  • Practically I don't think 64 KiB packets will be sent
  • 1500 bytes/packet is more likely
  • so ~30 KiB is a more typical max send size

I'm not sure what lower limit of bandwidth we should assume here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

set to PING_INTERVAL for now, as discussed

Copy link
Contributor

@flub flub left a comment

Choose a reason for hiding this comment

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

Mostly nits, only thing I'm not sure on yet is what is a reasonable send timeout for the magicsock

iroh-relay/src/ping_tracker.rs Show resolved Hide resolved
iroh-relay/src/protos/relay.rs Show resolved Hide resolved
@@ -623,13 +641,19 @@ impl ActiveRelayActor {
state: &mut ConnectedRelayState,
client_stream: &mut iroh_relay::client::ClientStream,
) -> Result<()> {
const SEND_TIMEOUT: Duration = Duration::from_secs(10); // TODO: what should this be?
Copy link
Contributor

Choose a reason for hiding this comment

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

contraints are:

  • MAX_PACKET_SIZE is set to 64 KiB
  • The client sends up to 20 packets at once (if this is too annoying we could take out that batching)
  • so worst-case a single send is 200 KiB
  • Practically I don't think 64 KiB packets will be sent
  • 1500 bytes/packet is more likely
  • so ~30 KiB is a more typical max send size

I'm not sure what lower limit of bandwidth we should assume here.

@flub
Copy link
Contributor

flub commented Jan 10, 2025

One feature we haven't considered here yet is to defer sending the pings if there's real traffic. That is, every time you receive some data you can reset the ping interval and postpone sending a ping. This is approximately what QUIC does.

@dignifiedquire
Copy link
Contributor Author

One feature we haven't considered here yet is to defer sending the pings if there's real traffic. That is, every time you receive some data you can reset the ping interval and postpone sending a ping. This is approximately what QUIC does.

Yes, I think we should do that 👍 this makes the overhead non existent during activity

@dignifiedquire
Copy link
Contributor Author

added the resetting of the ping intervals when messages are received

@dignifiedquire dignifiedquire added this pull request to the merge queue Jan 13, 2025
Merged via the queue into main with commit cd12da3 Jan 13, 2025
26 checks passed
@flub flub deleted the feat-relay-server-ping branch January 13, 2025 17:04
@n0-computer n0-computer deleted a comment from temoxtrading Jan 14, 2025
@n0-computer n0-computer deleted a comment from temoxtrading Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants