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

network/libp2p: worker CPU usage increases from v1.13.0 to v1.15.0 #5221

Open
alexggh opened this issue Aug 2, 2024 · 5 comments
Open

network/libp2p: worker CPU usage increases from v1.13.0 to v1.15.0 #5221

alexggh opened this issue Aug 2, 2024 · 5 comments

Comments

@alexggh
Copy link
Contributor

alexggh commented Aug 2, 2024

Our kusama validator have been upgraded from v1.13.0 to v1.15.0 and since then we see a dramatic increase in CPU usage:
Screenshot 2024-08-02 at 15 16 41

Dashboard: https://grafana.teleport.parity.io/goto/OgvYN59IR?orgId=1
The network seems to be fine, but we should aim to decrease the cpu usage.

The number of messages seems to have stayed the same and the entire networking increase seems to come from libp2p-node task.

Screenshot 2024-08-02 at 15 24 53

Note! there seems to be a small increase 5% in the cpu usage for litep2p, but not as dramatic as we see for libp2p-node, so my bet is that this might come from the libp2p upgrade we performed in v1.14.0: #1631.

cc @paritytech/networking
FYI @sandreim, @AndreiEres

@lexnv lexnv changed the title networking worker CPU usage increases from v1.13.0 to v1.15.0 network/libp2p worker CPU usage increases from v1.13.0 to v1.15.0 Aug 3, 2024
@lexnv lexnv changed the title network/libp2p worker CPU usage increases from v1.13.0 to v1.15.0 network/libp2p: worker CPU usage increases from v1.13.0 to v1.15.0 Aug 3, 2024
@dmitry-markin
Copy link
Contributor

I can confirm that networking CPU usage increased 2x after libp2p upgrade. Here are the results for versi network running 100 validators with libp2p-0.51.4 and 5 validators with libp2p-0.52.4:

The node from commit 3c21372 (the latest commit with libp2p-0.51.4)
image

The node from commit 414a8fc (the next commit from master, libp2p-0.52.4 upgrade)
image

The results for other nodes on the network from the same commits are consistent with average load within +/- 1%.

Even though the plots are quite noisy, the average networking CPU load definitely went 2x from 6% to 11%.

@alexggh
Copy link
Contributor Author

alexggh commented Aug 6, 2024

Any idea if the CPU increase leads to gains in other dimensions, like throughput/latency ?

@lexnv
Copy link
Contributor

lexnv commented Aug 6, 2024

After looking at litep2p vs libp2p nodes side by side, it seems that libp2p is establishing more connections than litep2p with connections limits.

Last time I checked, inbound connections are rejected only after establishing (ie negotiation).

I would add a limit in libp2p of 1k or lower to pending connections as well. We currently only limit establised (negotiated).

@dmitry-markin
Copy link
Contributor

Any idea if the CPU increase leads to gains in other dimensions, like throughput/latency ?

Nope. At least nothing points at it in the libp2p changelog.

@dmitry-markin
Copy link
Contributor

dmitry-markin commented Aug 6, 2024

The proper way forward with libp2p would be IMO upgrading it to the latest version, and if we still have the issues with CPU load - profiling and fixing libp2p. Unfortunately, even the upgrade of libp2p is already quite time consuming.

We can still introduce the limit @lexnv proposing, as this could mitigate the issue in some setups.

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

No branches or pull requests

3 participants