near / nearcore

Reference client for NEAR Protocol
https://near.org
GNU General Public License v3.0
2.32k stars 622 forks source link

Investigate potentially slowdowns in network code #3281

Open bowenwang1996 opened 4 years ago

bowenwang1996 commented 4 years ago

I observed two kinds of delays on testnet in the network module:

1. When we process routed messages https://github.com/nearprotocol/nearcore/blob/a480d6eb3d9c6542100efdc6364eb89daac69383/chain/network/src/peer_manager.rs#L1597 Example:

 Sep 02 09:00:53.422 WARN delay_detector: LONG DELAY! Took 594.014417ms processing routed message from PartialEncodedChunkRequest

It appears that this might be related to the performance of RouteBackCache.

2. When we send messages https://github.com/nearprotocol/nearcore/blob/a480d6eb3d9c6542100efdc6364eb89daac69383/chain/network/src/peer.rs#L209 Example:

 Sep 02 05:33:53.214 WARN delay_detector: LONG DELAY! Took 611.600167ms processing send message

It appears that this may have been caused by the suboptimal implementation of Tracker. More specifically, RateCounter can be slow when we send or receive a lot of messages.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity in the last 2 months. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.