Peer count slowly keeps dropping

Hi everyone!

I’ve had this happening for months and can’t seem to figure out if it’s a problem or normal.

I tend to restart my farmer every 3 months or so (power outage, maintaince, etc.). Every time I restart my farmer my peer count gets to 80 after a few hours, holds at 80 peers for a week or so, and then slowly begins to drop peers. After a few weeks now I’m currently connected to 9 peers. Everything is synced, running fine, etc., but why is my peer count so low? I haven’t touched the peer count in the config file. Is something wrong or is this normal?

Thanks in advance!

Dropping peers like you described is rather not normal. The protocol will drop some peers from time to time (when it has enough of them for whatever reason), but it will try to get new peers to replace them. So, this would indicate that for whatever reason peers cannot contact your node (8444 port problems).

There are two default values in config for the number of peers. The total (in/out-bound) that is set to 80 and outbound that is 8 or so. If for some reason peers cannot access your node (router port is not open, UPnP disabled), then your node will be happy with that 8 value.

If you sync from scratch (the fastest sync your node can handle) and you a have really strong node, your download rate will be around 1Mbps / 125KBps or so max. This means that your node can actually piggyback to just one peer and be happy with it and that peer will not feel the difference (although, having just one peer is not good for the network, and for your node, as that node can go sour on your node at any time and it will take some time to get a new one - although, this setup is good for a master/slave home setup).

So, to some extent, having 9 peers may indicate that there are some issues between your node and your router, and other peers cannot make an inbound connection.

If you worry about it, you can increase the number of outbound peers:

  target_outbound_peer_count: 20 (do not go to 80, as it is faster to get other peers to connect to you)

And monitor your node to see whether it will stop at 20. If it does, that would confirm that your node - router setup may not work well.

However, as mentioned, you can run on outbound nodes only - there is no difference whether connection was established by your node, or a peer. Potentially, getting up to the specified number of nodes will be slower, if other nodes are not permitted to connect. Again, nothing to worry, as the minute you get the first peer, your node is happy.

1 Like

It’s totally normal on my machine… but i appreciate it shouldn’t be so.
I’m down to 33 since I last rebooted, was 34 2 days ago.

Is higher peer count good for farmer?

Pending on your router UPnp will clean out older requests. Might be worth looking at the router settings. It has been my belief that a healthy level of peers will keep you more up to date on chian changes and keep you more likely to submit relevant answers. I would love to see some kind of experiment 2 similar size farms one with large number one with small number of peers. Over a long period of time.

No, no difference at all. Even if your farmer runs with 10 or so peers that is more than plenty.

An argument can be made what is good for the network (how resilient network can be with different number of peers on each node), but that is a different thing. Anyway, the default value of 80 was potentially used as someone used his/her parents age and multiplied it by some. Just bad software design.

Not really. If you check the official setup instructions, it is good enough to run with blocked port 8444 and disabled UPnP. With that said, the default max of 8 outbound peers kicks in. Unless you modify your config.yaml, that is what estimated to be good enough for network resilience. Once you either enable UPnP or open port 8444, you let other peers connect to your node, and at that point the 80 peers count kicks in.

Your router should be transparent, and not interfere with what your box does. However, assuming that it does, the node cannot tell whether the peer dropped because your router decided to drop it, or rather the node decided to go somewhere else (rebooted). Therefore, your p2p stack is design to handle those disconnections, and get new peers when needed.

Basically, we need to assume that the network is mostly healthy. If there are some events like dust storms, some percentages of nodes are going to go bad. However, from any node point of view, that percentage should also be reflected in connected peers. It means, that no peer is a magnet for “bad” or “low performing” nodes, as such should have enough good nodes to run.

The main / only reason that some people report plenty of those “stale” nodes is that their node is out of whack and cannot handle network traffic anymore - thus appearing like all peers are bad. Unfortunately, some folks still push that false story “stale peers are killing my node.”

Thanks for the detailed information and help, I really appreciate it!

I just went into the router settings - uPNP was already enabled, and I just set up port forwarding on 8444. Within minutes I started seeing more peers!

You need to check your config.yaml, as UPnP has to be enabled also there. I am not sure what is the default value.

Kind of a problem with UPnP is that once you open it up on the router side, that let any box / program (e.g., malware) on your LAN to start opening ports. You may want to read about security implications of going that route.

On the other hand, when you open your 8444 port, that is a dedicated pinhole that only works for that one box. However, you need to make sure that you have sticky IPs on your LAN (i.e., your router will always give the same IP address to your box), or your box is setup with a static IP.

Thanks for the note. I just set-up that server with a static IP to ensure it doesn’t change. Thanks again!