libp2p.perf package
The perf module implements the libp2p performance measurement protocol, which allows measuring throughput between two libp2p nodes by sending and receiving configurable amounts of data.
Submodules
libp2p.perf.constants module
libp2p.perf.types module
Perf protocol types.
Spec: https://github.com/libp2p/specs/blob/master/perf/perf.md
libp2p.perf.perf_service module
Perf protocol service implementation. Spec: https://github.com/libp2p/specs/blob/master/perf/perf.md
- Note:
This service is designed for benchmarking and performance testing. The server accepts any uint64 value for bytes to send back, which is intentional to support high-volume stress testing. This service should only be enabled in trusted environments or test networks.
- class libp2p.perf.perf_service.PerfService(host: IHost, init: PerfInit | None = None)
Bases:
IPerfImplementation of the perf protocol.
The perf protocol is used to measure transfer performance within and across libp2p implementations.
- async measure_performance(multiaddr: Multiaddr, send_bytes: int, recv_bytes: int) AsyncIterator[PerfOutput]
Measure transfer performance to a remote peer.
Parameters
- multiaddrMultiaddr
The address of the remote peer to test against.
- send_bytesint
Number of bytes to upload to the remote peer.
- recv_bytesint
Number of bytes to request the remote peer to send back.
Yields
- PerfOutput
Progress reports during the transfer, with a final summary at the end.
Module contents
Perf protocol for measuring transfer performance.
This module implements the libp2p perf protocol as specified in: https://github.com/libp2p/specs/blob/master/perf/perf.md
- class libp2p.perf.IPerf
Bases:
ABCInterface for the perf protocol service.
Spec: https://github.com/libp2p/specs/blob/master/perf/perf.md
- abstract measure_performance(multiaddr: Multiaddr, send_bytes: int, recv_bytes: int) AsyncIterator[Any]
Measure transfer performance to a remote peer.
Parameters
- multiaddrMultiaddr
The address of the remote peer to test against.
- send_bytesint
Number of bytes to upload to the remote peer.
- recv_bytesint
Number of bytes to request the remote peer to send back.
Yields
- PerfOutput
Progress reports during the transfer, with a final summary at the end.
- class libp2p.perf.PerfService(host: IHost, init: PerfInit | None = None)
Bases:
IPerfImplementation of the perf protocol.
The perf protocol is used to measure transfer performance within and across libp2p implementations.
- async measure_performance(multiaddr: Multiaddr, send_bytes: int, recv_bytes: int) AsyncIterator[PerfOutput]
Measure transfer performance to a remote peer.
Parameters
- multiaddrMultiaddr
The address of the remote peer to test against.
- send_bytesint
Number of bytes to upload to the remote peer.
- recv_bytesint
Number of bytes to request the remote peer to send back.
Yields
- PerfOutput
Progress reports during the transfer, with a final summary at the end.