Skip to content

Latest commit

 

History

History
42 lines (32 loc) · 1.26 KB

tip-366.md

File metadata and controls

42 lines (32 loc) · 1.26 KB
tip: 366
title: TIP-366 Node startup optimization
author: [email protected]
discussions to: https://github.com/tronprotocol/tips/issues/366
status: Final
type: Standards Track
category: Core
created: 2022-01-24

Abstract

Currently, it takes about 1 minute from node starts to block synchronization. Block synchronization depends on node tcp establishment.During the start-up,the current tcp connection establishment thread is delayed by 30s to wait neighbors discovery. However, when node.discovery.persist = true, the current discovered node will be stored persistently at regular intervals.

Specification

Change TCP initialDelay from 30s to 100ms, TCP connection using last persistent node information instead of waiting for 30s.

Motivation

Speed up TCP establishment for the purpose of fast node startup.

Implementation

SyncPool

public void init() {
        //......
        poolLoopExecutor.scheduleWithFixedDelay(() -> {
        try {
        //.... node discovery
        } catch (Throwable t) {
        logger.error("Exception in sync worker", t);
        }
        }, 100, 3600, TimeUnit.MILLISECONDS);
        
        }        

Rationale

TCP initialDelay take up much time(30s) during node start up(about 1min).