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

chat and chat-tokio examples: high CPU consumption (Ubuntu 20.04) #2675

Closed
ddeguglielmo opened this issue May 27, 2022 · 4 comments
Closed

Comments

@ddeguglielmo
Copy link

Summary

Both chat and chat-tokio examples have very high CPU consumption (close to 100%).

Expected behaviour

I do not expect the examples to have such an high CPU consumption when no messages are exchanged.

Actual behaviour

I have two instances of chat (chat-tokio) example running on the same machine. After the publication of the first message by part of the first peer (that is correctly received by the second one), the CPU consumption of the processes increases significantly and reaches 100%.

Possible Solution

When we tested the same examples on a machine running macOS, we have not observed such an high CPU usage.

Version

  • libp2p version: master branch
  • OS: Linux Ubuntu 20.04

Would you like to work on fixing this bug?

Yes.

@mxinden
Copy link
Member

mxinden commented May 29, 2022

Thanks for the report. https://github.com/tokio-rs/console might help here debugging the issue. Help greatly appreciated.

gallegogt added a commit to gallegogt/rust-libp2p that referenced this issue Jun 29, 2022
In the previous version of the code the readable and writable functions were running constantly causing high CPU consumption constantly when using tokio as runtime.

Fix libp2p#2591
Fix libp2p#2675
gallegogt added a commit to gallegogt/rust-libp2p that referenced this issue Jun 29, 2022
In the previous version of the code the readable and writable functions were running constantly causing high CPU consumption constantly when using tokio as runtime.

Fix libp2p#2591
Fix libp2p#2675
@mxinden
Copy link
Member

mxinden commented Oct 5, 2022

@ddeguglielmo with the latest changes to libp2p-mdns does the above issue still persist?

@ddeguglielmo
Copy link
Author

Hello @mxinden,
I have just finished testing both chat and chat-tokio examples (I used the current master branch version). The examples work correctly and the CPU consumption of the processes is very low. Thus the issue is not present anymore.

@mxinden
Copy link
Member

mxinden commented Oct 11, 2022

Wonderful. Thanks @ddeguglielmo for testing. And of course @gallegogt and @thomaseizinger for fixing this issue!

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