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
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.
Change TCP initialDelay from 30s to 100ms, TCP connection using last persistent node information instead of waiting for 30s
.
Speed up TCP establishment for the purpose of fast node startup.
public void init() {
//......
poolLoopExecutor.scheduleWithFixedDelay(() -> {
try {
//.... node discovery
} catch (Throwable t) {
logger.error("Exception in sync worker", t);
}
}, 100, 3600, TimeUnit.MILLISECONDS);
}
TCP initialDelay take up much time(30s) during node start up(about 1min).