Keeping topology fresh: how often to restart node and why? Questions about scripts and restarting

Hi everyone,

I have a relay node set up, and just set up my staking pool.

I have read over some other posts and replies and found some extra bits and pieces, like restarting a node to keep the topology fresh.

What is that, and why the need to restart? As far as I can tell from looking at the topology file, this might be a list of other relay nodes to connect with.

I understand this could be important in case a pool is selected as a slot leader and has the opportunity to create a block. Does a fresh topology mean a lower chance of an orphaned block? I.e. it has a greater chance of being broadcast around the relays fast enough to be accepted into the blockchain?

I am not using the Guild scripts, so I don’t have a topology updater script. But I think I can modify the script and use it standalone for my installation.

Also, how often should I restart my node, and what node is that? (Block producer or relay or both?)



A fresh topology will help u to stay connected always/only with online servers

How are the peers for my topology file selected?:anchor:

We calculate the distance on the Earth’s surface from your node’s IP to all subscribed peers. We then order the peers by distance (closest first) and start by selecting one peer. We then skip some, pick the next, skip, pick, skip, pick … until we reach the end of the list (furthest away). The number of skipped records is calculated in a way to have the desired number of peers at the end.

Every requesting node has its personal distance to all other nodes.

We assume this should result in a well-distributed and interconnected peering network.

By default the relay should be restarted once/24 hours but u can increase the time (it’s up to you)


I’m restarting relays every 24 hours (at different times of course). Restarting of bp node is not necessary (it’s topology stays the same and there’s no topologyUpdater running on the bp node).

I’m also using the python variant of topologyUpdater (GitHub - Josef3110/stakepool_python_tools: some tools written in python to run cardano staking pools) because it is easier to configure and comes with it’s own monitoring.

1 Like

It’s completely unnecessary to restart your relays that often. I think once every 1-2 epochs suffices, unless you see problems with you outgoing connections or your memory usage goes too high. Try keeping minimum one registered relay online at all times though to avoid wallet/block explorer delisting; restart your relays at different times.

1 Like

Hi, thanks that was very helpful.

I did notice once when fiddling with cardano-node’s parameters that my relay crashed after syncing the blockchain. It was a memory issue. Definitely need over 8GB now for a relay with default options. I like to have machines with 16GB RAM to keep the nodes humming.

Looks like I don’t have to reboot very often now, maybe once a week or so.

Looks very promising. Limited to one request per hour at the back end, is there a work-around for that? Maybe another service?

I only update the topology every few epochs at most. You shouldn’t need more than hourly requests for the topology pull.

Actually, topologyUpdater does 2 things, one is a ping (with that one request per hour limit) and the second one is a request with a new list of peers for the topology. The ping gets your pool on the list for relays active to participate the network. I.e., if you ping 4 times (4 hours) then your relay gets on the list. If you stop the ping for 4 hours your relay will be removed from the list.

Not being on the list has the consequence of other relays not connecting to your relay and thus not pulling blocks from your block producer.

Retrieving new topology has the effect of new pools getting a chance to participate in the network. It also helps to have a robust network. As a matter of fact one has only to retrieve a new topology before restarting the relay, because otherwise the new topology file won’t have any effect.

As you might have guessed, this is a centralized service and that’s the reason for the one hour interval. The service provider has to maintain requests of over 3000 pools in operation.

IOG is working on a more de-centralized way of connecting pools called p2p. But this is a quite complex task and still in test. As soon as IOG is releasing p2p, we can turn off topologyUpdater and configure our relays to use p2p.

It depends on which script you use. I have two distinct scripts: one to hourly do the ping and one to fetch a new topology. Even if you use one script to do both every hour, you can just keep your node running and only restart every couple days or so at which point the last fetched topology will be used.

Having 2 scripts is the perfect solution, doing both in the same script also works, but adds stress to the central server sending out topology files.