Skip to content

Many P2P performance improvements

Dan Notestein requested to merge p2p_performance into develop

Forkdb is now separately locked from chainbase (forkdb's public interface calls encapsulate these locks), allowing p2p code to get read locks on forkdb without locking chainbase and blocking write queue. Exposed fc::set_thread_name function and used it to label p2p and write_queue thread. The p2p thread and write_queue processing code use fc locks instead of boost locks to avoid completely blocking p2p thread (avoid stopping of all p2p tasks). To remove chainbase lock around find_block_id_for_num, we eliminated supposed fast-check of tapos buffer and now we check forkdb before checking block_log. Moved logic for get_blockchain_synopsys from chain_plugin to database and rewrote logic to avoid a chainbase lock (testing still in progress). Upped amount of blocked_ids to prefetch from 10k to 100k. Upped max amount of blocks to prefetch to 100k (from 2000). In fetch_sync_items_loop report number of peers that were idle when we tried to fetch more blocks. In process_backlog_of_sync_blocks, eliminate extra copying of block data with lamda capture initializer. Async call to process_block_message and process_ordinary_message in on_message to spawn a separate task to cleanup after each block/transaction is processed by the blockchain. Added some logging and temporarily quieted some. Added a logging block that reports any peer that is likely to be stalling the write_queue (waiting on a block from). Compute percentage time spent in write_queue, waiting for write_queue locks, waiting for more blocks/transactions to be added to write_queue. Added option to insert additional delay into transaction processing time ever N number of transactions to see how p2p handles slow processing of items in the write_queue. Added temporary 1ms delay after finishing a write_queue processing loop to avoid busy looping while syncing (in live sync mode, there was already a 10ms sleep). Log whenever peer_count changes. Log when blocks/transactions pushed to write_queue and when they are popped from write_queue.

Merge request reports