xrpld
Loading...
Searching...
No Matches
ReduceRelayCommon.h
1#pragma once
2
3#include <chrono>
4#include <cstddef>
5#include <cstdint>
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
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 kMinUnsquelchExpire = std::chrono::seconds{300};
20static constexpr auto kSquelchPerPeer = std::chrono::seconds(10);
21static constexpr auto kMaxUnsquelchExpirePeers = std::chrono::seconds{3600};
22// No message received threshold before identifying a peer as idled
23static constexpr auto kIdled = 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// kMinMessageThreshold to considered pool once kMaxSelectedPeers
27// reach kMaxMessageThreshold.
28static constexpr uint16_t kMinMessageThreshold = 19;
29static constexpr uint16_t kMaxMessageThreshold = 20;
30// Max selected peers to choose as the source of messages from validator
31static constexpr uint16_t kMaxSelectedPeers = 5;
32// Wait before reduce-relay feature is enabled on boot up to let
33// the server establish peer connections
34static constexpr auto kWaitOnBootup = 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 kMaxTxQueueSize = 10000;
40
41} // namespace xrpl::reduce_relay
static constexpr uint16_t kMinMessageThreshold
static constexpr auto kSquelchPerPeer
static constexpr auto kMinUnsquelchExpire
static constexpr uint16_t kMaxMessageThreshold
static constexpr std::size_t kMaxTxQueueSize
static constexpr auto kWaitOnBootup
static constexpr auto kMaxUnsquelchExpireDefault
static constexpr auto kMaxUnsquelchExpirePeers
static constexpr auto kIdled
static constexpr uint16_t kMaxSelectedPeers