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

UDT implementation #40

Open
Kleissner opened this issue Oct 14, 2021 · 4 comments
Open

UDT implementation #40

Kleissner opened this issue Oct 14, 2021 · 4 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@Kleissner
Copy link
Contributor

Kleissner commented Oct 14, 2021

Keeping track of important links to UDP implementations.

Specs via https://udt.sourceforge.io/doc.html:

Protocol of choice: UDP

UDP seems to fit the use case (file transfer) squarely. QUIC might be an overkill and uTP might have undesired side effects (quote from the spec "This effectively makes uTP yield to any TCP traffic").

The trick will be to fork the implementation from odysseus654 and instead of using new UDP connections, using the existing Peernet protocol as transport layer.

Before starting with the actual implementation, a new file transfer message must be defined in Peernet with a small header. The header must include:

  • Protocol: 0 = UDP
  • Control: 0 = Request start, 1 = Terminate hash not found, 2 = Terminate protocol not supported, 3 = Terminate
  • File hash and size
  • Offset and Limit
@Kleissner Kleissner self-assigned this Oct 14, 2021
@Kleissner Kleissner added the documentation Improvements or additions to documentation label Oct 14, 2021
@Kleissner
Copy link
Contributor Author

Kleissner commented Oct 16, 2021

Also relevant to look at - uTP. Documented here https://www.bittorrent.org/beps/bep_0029.html

Long discussion about uTP and UDT libraries and their status: ipfs/kubo#58
Updated discussion here: ipfs/kubo#6481

@Kleissner
Copy link
Contributor Author

Kleissner commented Oct 16, 2021

A third option would be QUIC.

QUIC seems to be an overkill for this use case. Simplicity is winning here.

@Kleissner
Copy link
Contributor Author

Kleissner commented Jan 15, 2022

Since embedding the actual payload data in regular Peernet packets is very expensive, a new concept of "lite packets" is established. They have a small header which bypass all regular checks. They are identified via session IDs.

This fixes the CPU bottleneck that appeared due to signing (and decrypting) the transfer packets. Before, TransferMaxEmbedSize was set to 1121 bytes.

const TransferMaxEmbedSize = internetSafeMTU - PacketLengthMin - transferPayloadHeaderSize

For lite packets it is 1214 bytes, an 8% increase.

@Kleissner
Copy link
Contributor Author

Just implemented lite packets in f305e5b. Stats still need to be recorded upon receiving in Networks.packetWorkerLite.

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

No branches or pull requests

1 participant