ChainSafe / js-libp2p-noise

Noise libp2p handshake for js-libp2p
Other
37 stars 30 forks source link

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

Closed achingbrain closed 11 months ago

achingbrain commented 11 months ago

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