Combined summary - CPU usage of peers
A comprehensive analysis of CPU usage by peers in Bitcoin Core has been conducted with a focus on the `ProcessMessages()` and `SendMessages()` functions.
The study utilized a tracepoint at the end of these functions to collect data via
bpftrace, which was then logged in CSV format. Conducted on a node hosted on a VPS with four AMD EPYC 7R32 cores, the research highlighted that Bitcoin Core's message handling thread operates single-threadedly.
The study observed differences in CPU usage based on the type of peer connections, excluding those maintained for less than a minute. It was noted that full-relay connections required more CPU resources compared to block-relay-only connections. During peak times, CPU utilization for message processing reached up to 1000ms per second, effectively maxing out one core. Outbound full-relay connections were particularly resource-intensive, averaging around 600µs per second, whereas both inbound and outbound block-relay-only connections demanded significantly less, averaging just under 100µs per second.
The research also delved into the time spent processing various types of messages. Full-relay peers managed a mix of messages with
tx messages being the most costly in terms of processing time, while block-relay-only peers primarily handled
getdata messages and processed
version messages more expeditiously.
Concerning modifications to the number of connection slots, the study projected a 34% increase in CPU usage from the current configuration's 34.6ms per second to 46.4ms when considering proposed changes. However, the anticipated rise in CPU usage from increasing block-relay-only connections was deemed negligible. It was also suggested that differing hardware specifications, such as those of the Raspberry Pi 4, could lead to varied performance outcomes.
The study did not include CPU time related to Initial Block Download processes since it was performed on a pruned node. Additionally, the potential impacts of improvements like Erlay on CPU usage were mentioned, though no firm conclusions were provided. The research underscored the importance of collaborative efforts within the Bitcoin development community and acknowledged MIT DCI's sponsorship of the node used in this study.