This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Description
Currently substrate is based on libp2p 0.14.0-alpha.1 which has a few issues:
- Network opens a lot of TCP connections. After running for a few hours on kusama the number of connections reported by
lsof is over 2000.
- Each connection preallocates at least 176 kbytes of memory for buffers in the noise protocol.
Which leads to memory usage in hundreds of megabytes.
- Each connection spawns a short-lived thread, which leads to a leak in
sysinfo crate.
Each of these should be fixed as soon as possible. Substrate already has a limit for protocol connections. That limit must be enforced as a global limit for TCP connections, including Kademlia and all other protocols.
All buffers should be preallocated to some small size, like 1k. The rest should be allocated lazily.