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

Enable block archival sync #3579

Merged
merged 6 commits into from
Mar 16, 2021
Merged

Conversation

antiochp
Copy link
Member

@antiochp antiochp commented Mar 2, 2021

Archival Peers (as of 20210315) -

  • 78.47.168.92:3414
  • 46.101.247.184:3414
  • 3.81.230.109:3414
  • 23.124.76.209:3414
# configure the above as peers_preferred to help archive node connectivity
peers_preferred = ["78.47.168.92:3414", "46.101.247.184:3414", "3.81.230.109:3414", "23.124.76.209:3414"]

Two relatively minor changes that allow a node to run in "block archival mode" and sync fully from other archival peers.
This works in conjunction with various related PRs recently merged.

  1. Simply return false for check_txhashset_needed() if running with archive_mode enabled
  2. No longer skip compaction during sync (compact periodically during full archival sync).

The local chain_data dir should be cleared out prior to a full archival sync - the node will sync from scratch.

A node will only be able to sync historical blocks from other archival nodes.
The best way of configuring the local node to peer with archival nodes is via the following config.

#
# with [server] section -
#

archive_mode = true


#
# within [server.p2p_config] section -
# 

# These are known archival nodes. Sync works best if these are both "preferred" and "allow".
peers_preferred = ["85.10.201.143:3414", "49.12.108.173:3414", "176.9.86.219:3414", "116.203.154.223:3414", "213.239.217.14:3414", "46.101.247.184:3414"]
peers_allow = ["85.10.201.143:3414", "49.12.108.173:3414", "176.9.86.219:3414", "116.203.154.223:3414", "213.239.217.14:3414", "46.101.247.184:3414"]

Once the node has completed an archival sync we can update the config to allow other nodes to connect.

# No explicit peers_allow list, so all peers implicitly allowed.
# peers_allow = ["85.10.201.143:3414", "49.12.108.173:3414", "176.9.86.219:3414", "116.203.154.223:3414", "213.239.217.14:3414", "46.101.247.184:3414"]

Full archival sync takes several hours to complete, probably close to 24 hours.
On completion the local node will have full block history from height 1 onwards.

Disk usage is approx 9.5GB for a full archival node.


It is anticipated that peers_preferred will be a required config for archival nodes, to ensure we good good connectivity.

The additional peers_allow config is a temporary solution while we test this out prior to having nodes correctly advertising archival capabilities.


TODO

  • uncomment the BLOCK_HIST capability filtering (we only sync from other archival nodes)
  • collect a list of known good ip addresses for existing archival nodes so we can publish a list of preferred peers for bootstrapping
  • release this as part of 5.1.0

@antiochp antiochp changed the title WIP - block archival sync Enable block archival sync Mar 7, 2021
@antiochp antiochp marked this pull request as ready for review March 7, 2021 15:13
@antiochp
Copy link
Member Author

antiochp commented Mar 7, 2021

If we have consensus that this is something we want to roll out to mainnet then I propose we consider a 5.1.0 release in the next couple of weeks. This would include this change along with other changes currently on master.

The "bootstrapping" change (discussed above) will ensure network traffic and peering is unaffected for non-archive nodes (archival sync restricted to known archive peers).

@antiochp
Copy link
Member Author

antiochp commented Mar 7, 2021

I understand @quentinlesceller is experiencing really slow archive sync.
This appears limited to some local nodes as we are not seeing this across every archive node. Possibly slow disk or some other local environmental factor.
Solving that is outside the scope of this PR - we can (and will) investigate and optimize in a subsequent PR.

@bladedoyle
Copy link
Contributor

I completed a sync on bare metal i9 cpu + ssd in just over 38 hours.
ending disk use: 7.9 GB
Everything looks good to me.

@antiochp
Copy link
Member Author

antiochp commented Mar 7, 2021

For reference a $5/month Digital Ocean instance sync'd in about 20 hours.
So maybe bandwidth is a bigger factor than disk speed.

@bladedoyle
Copy link
Contributor

bladedoyle commented Mar 7, 2021

My test sync was done with 1 GB fiber...
None of the peers data xfer rate ever got above about 12K/sec, including a local full node peer.

ftr: the sync started with 3 peers, gained peers over the first few hours, and ended with (currently has) 7 peers.

one more note: my test sync did not allow inbound connections, all outbound

@antiochp
Copy link
Member Author

antiochp commented Mar 9, 2021

My test sync was done with 1 GB fiber...
None of the peers data xfer rate ever got above about 12K/sec, including a local full node peer.

ftr: the sync started with 3 peers, gained peers over the first few hours, and ended with (currently has) 7 peers.

one more note: my test sync did not allow inbound connections, all outbound

Is this with allow and preferred lists configured against known archival nodes?

@antiochp antiochp added this to the 5.1.0 milestone Mar 9, 2021
@antiochp
Copy link
Member Author

Going to merge this to master.
Anybody wanting to run this code with archive_mode=true enabled is advised to specify an explicit set of known archive nodes in their peers_preferred config.

@antiochp antiochp merged commit 6690b25 into mimblewimble:master Mar 16, 2021
@antiochp antiochp deleted the archival_thread branch March 16, 2021 12:04
@antiochp antiochp mentioned this pull request May 6, 2021
bayk added a commit to mwcproject/mwc-node that referenced this pull request Jun 17, 2024
* wip - body sync for full archive
* allow chain compaction during sync
* placeholder for logic to ensure archive nodes sync from archive nodes
* body sync from archival peers
* allow chain compaction during sync
* placeholder for logic to ensure archive nodes sync from archive nodes
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

Successfully merging this pull request may close these issues.

3 participants