maidsafe / safe_network

66 stars 40 forks source link

fix(manager): use rpc to check if a node is running or not #1887

Closed RolandSherwin closed 3 weeks ago

RolandSherwin commented 1 month ago
jacderida commented 1 month ago

Hey Roland,

Good point about the restarts, but people in the community have noted issues with excessive CPU usage when using the RPC service. We may want to just think about this one. I seem to remember I made changes for looking up the location of the exe for the process, which was unique, because each exe has its own service directory. We might be able to do this after restart?

RolandSherwin commented 1 month ago

Hey @jacderida, that sounds good too. So do we know for sure that RPC is causing issues? It is just a tiny webserver that we rarely send requests to.

jacderida commented 1 month ago

I've had quite a few messages saying that it seems to spike CPU usage, and in turn that may be what is causing the node manager to take so long to refresh a large number of nodes. I have never had time to properly investigate and determine whether it is the real cause of the spikes, so I can't say for sure.

I have just had another thought though: if we are simply just checking the connection here, as opposed to running one of the commands, maybe that might be OK.

RolandSherwin commented 1 month ago

Right I see.

I'm okay with either approach. Just one thing to keep in mind is the time it'd take to refresh many nodes. The current method by checking the connection take 3 seconds to respond back if the node is down, i.e., rpc server is inactive. This is without any retry and by just checking for connection. So I had to do perform the checks in parallel for 50 nodes at a time.

But with your approach, I think even if we do it sequentially, we'd finish within a couple ms. In that case, we can go with yours.