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