mrusme / superhighway84

USENET-inspired, uncensorable, decentralized internet discussion system running on IPFS & OrbitDB
https://xn--gckvb8fzb.com/superhighway84
GNU General Public License v3.0
694 stars 24 forks source link

CPU Usage #23

Closed Jonty closed 2 years ago

Jonty commented 2 years ago

On my mac superhighway84 slams all the cores on startup for a few minutes, then ramps down to just using one entire core. This seems ...suboptimal.

If there's anything I can do to help debug let me know.

mrusme commented 2 years ago

I noticed this behavior on the macbook I have lying around here as well. However, it's not always the case and it seems to be related to #14 unfortunately. I will keep investigating.

mrusme commented 2 years ago

screenshot_2021-12-29-004905

That's the usage on my Linux machine with the latest master commit. Will test on the macbook as well.

mrusme commented 2 years ago

@Jonty please try setting your IPFS repository to lowpower profile and test with that:

ipfs config profile apply lowpower

See this for more info.

mrusme commented 2 years ago

I've tested the above profile on the macbook, as well as two small-scale VPS and they've all been running for the past day with no issues at all. This seems to have more or less fixed this issue. I've documented it already in the README, so people should be go to go.

Jonty commented 2 years ago

Sadly this doesn't appear to have worked for me. Am using the latest IPFS from homebrew (0.11.0) and superhighway84 0.0.7. SH84 says I generally have ~2k peers.

Happy to help debug if I can run any useful tests

mrusme commented 2 years ago

@Jonty that is correct, it will show ~2k peers for a couple of minutes, as described in the README.md. However, it should eventually go down to ~200. Could you test running superhighway84 for a longer period of time and see whether the peer connections normalize?

Also, would you mind sharing some over-time graphs of your CPU usage to get more specific numbers?

Thank you!

Jonty commented 2 years ago

Aha, I didn't realise that the startup spike was expected. It settled down after ~15mins and is fine then, although it's still constantly using ~30% of one core!

mrusme commented 2 years ago

Any info on what type of of CPU that is? Are we talking about a latest gen CPU or something from the 2010s?

Jonty commented 2 years ago

It's a 2015 i7, so not super recent!

mrusme commented 2 years ago

@Jonty I've been keeping one instance of Superhighway84 running on a 1 VCPU 1 GB RAM VPS for over a week now. It hasn't been killed due to overly high CPU load nor due to an extreme amount of connections. I've configured the repo the way I described it.

Your 2015 i7 should most definitely be able to handle the load and not show significant resource usage. I'm tempted to argue that maybe it's a system-wide issue with your specific installation.

Could you please run ipfs daemon on that very same repository and see how the CPU behaves as compared to when you run Superhighway84?

Also:

Also, would you mind sharing some over-time graphs of your CPU usage to get more specific numbers?

Thank you!