rippled
Loading...
Searching...
No Matches
ReduceRelayCommon.h
1#pragma once
2
3#include <chrono>
4
5namespace xrpl {
6
7// Blog post explaining the rationale behind reduction of flooding gossip
8// protocol:
9// https://xrpl.org/blog/2021/message-routing-optimizations-pt-1-proposal-validation-relaying.html
10
11namespace reduce_relay {
12
13// Peer's squelch is limited in time to
14// rand{MIN_UNSQUELCH_EXPIRE, max_squelch},
15// where max_squelch is
16// min(max(MAX_UNSQUELCH_EXPIRE_DEFAULT, SQUELCH_PER_PEER * number_of_peers),
17// MAX_UNSQUELCH_EXPIRE_PEERS)
18static constexpr auto MIN_UNSQUELCH_EXPIRE = std::chrono::seconds{300};
20static constexpr auto SQUELCH_PER_PEER = std::chrono::seconds(10);
22// No message received threshold before identifying a peer as idled
23static constexpr auto IDLED = std::chrono::seconds{8};
24// Message count threshold to start selecting peers as the source
25// of messages from the validator. We add peers who reach
26// MIN_MESSAGE_THRESHOLD to considered pool once MAX_SELECTED_PEERS
27// reach MAX_MESSAGE_THRESHOLD.
28static constexpr uint16_t MIN_MESSAGE_THRESHOLD = 19;
29static constexpr uint16_t MAX_MESSAGE_THRESHOLD = 20;
30// Max selected peers to choose as the source of messages from validator
31static constexpr uint16_t MAX_SELECTED_PEERS = 5;
32// Wait before reduce-relay feature is enabled on boot up to let
33// the server establish peer connections
34static constexpr auto WAIT_ON_BOOTUP = std::chrono::minutes{10};
35// Maximum size of the aggregated transaction hashes per peer.
36// Once we get to high tps throughput, this cap will prevent
37// TMTransactions from exceeding the current protocol message
38// size limit of 64MB.
39static constexpr std::size_t MAX_TX_QUEUE_SIZE = 10000;
40
41} // namespace reduce_relay
42
43} // namespace xrpl
static constexpr auto IDLED
static constexpr auto MAX_UNSQUELCH_EXPIRE_DEFAULT
static constexpr uint16_t MIN_MESSAGE_THRESHOLD
static constexpr auto WAIT_ON_BOOTUP
static constexpr uint16_t MAX_SELECTED_PEERS
static constexpr auto SQUELCH_PER_PEER
static constexpr auto MAX_UNSQUELCH_EXPIRE_PEERS
static constexpr auto MIN_UNSQUELCH_EXPIRE
static constexpr std::size_t MAX_TX_QUEUE_SIZE
static constexpr uint16_t MAX_MESSAGE_THRESHOLD
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5