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

fix: concatenate encrypted data length prefix with data before sending #387

Merged

Conversation

achingbrain
Copy link
Collaborator

Sending lots of tiny buffers kills TCP performance, even with noDelay disabled.

Sending the encrypted data length along with the data in one buffer increases @libp2p/perf throughput with noise+yamux from 300-320 MB/s to 320-340 MB/s

Flame graphs showing Socket._writeGeneric (e.g. writing to the TCP socket) while running the performance test:

Before:

image

After:

image

Sending lots of tiny buffers kills TCP performance, even with `noDelay` disabled.

Sending the encrypted data length along with the data in one buffer
increases `@libp2p/perf` throughput with noise+yamux from 300-320 MB/s to 320-340 MB/s
@achingbrain achingbrain requested a review from a team as a code owner November 12, 2023 17:47
@mpetrunic mpetrunic merged commit 2be73dc into ChainSafe:master Nov 13, 2023
13 checks passed
@achingbrain achingbrain deleted the fix/concat-encrypted-byte-length branch November 22, 2023 08:23
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