Skip to content

Commit

Permalink
Mandate flow control in bytes (#4353)
Browse files Browse the repository at this point in the history
Resolves #3781 and #4374.

This change removes the `ENABLE_FLOW_CONTROL_BYTES` config option and
always uses flow control in bytes.

# Checklist
- [x] Reviewed the
[contributing](https://github.com/stellar/stellar-core/blob/master/CONTRIBUTING.md#submitting-changes)
document
- [x] Rebased on top of master (no merge commits)
- [x] Ran `clang-format` v8.0.0 (via `make format` or the Visual Studio
extension)
- [x] Compiles
- [x] Ran all tests
- [ ] If change impacts performance, include supporting evidence per the
[performance
document](https://github.com/stellar/stellar-core/blob/master/performance-eval/performance-eval.md)
  • Loading branch information
marta-lokhova authored Aug 7, 2024
2 parents 79f2b5f + ee2bd68 commit ec3c8e8
Show file tree
Hide file tree
Showing 14 changed files with 215 additions and 423 deletions.
5 changes: 0 additions & 5 deletions docs/stellar-core_example.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -530,11 +530,6 @@ PEER_FLOOD_READING_CAPACITY_BYTES=300000
# processes `FLOW_CONTROL_SEND_MORE_BATCH_SIZE_BYTES` bytes
FLOW_CONTROL_SEND_MORE_BATCH_SIZE_BYTES=100000

# Enable flow control in bytes. This config allows core to process large
# transactions on the network more efficiently and apply back pressure if
# needed.
ENABLE_FLOW_CONTROL_BYTES=true

# Byte limit for outbound transaction queue.
OUTBOUND_TX_QUEUE_BYTE_LIMIT=3145728

Expand Down
1 change: 1 addition & 0 deletions src/herder/Herder.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class Herder

virtual VirtualTimer const& getTriggerTimer() const = 0;
virtual void setMaxClassicTxSize(uint32 bytes) = 0;
virtual void setMaxTxSize(uint32 bytes) = 0;
virtual void setFlowControlExtraBufferSize(uint32 bytes) = 0;

virtual ClassicTransactionQueue& getTransactionQueue() = 0;
Expand Down
5 changes: 5 additions & 0 deletions src/herder/HerderImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ class HerderImpl : public Herder
{
mMaxClassicTxSize = std::make_optional<uint32_t>(bytes);
}
void
setMaxTxSize(uint32 bytes) override
{
mMaxTxSize = bytes;
}
std::optional<uint32_t> mFlowControlExtraBuffer;
void
setFlowControlExtraBufferSize(uint32 bytes) override
Expand Down
9 changes: 2 additions & 7 deletions src/main/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ Config::Config() : NODE_SEED(SecretKey::random())
LEDGER_PROTOCOL_VERSION = CURRENT_LEDGER_PROTOCOL_VERSION;
LEDGER_PROTOCOL_MIN_VERSION_INTERNAL_ERROR_REPORT = 18;

OVERLAY_PROTOCOL_MIN_VERSION = 32;
OVERLAY_PROTOCOL_VERSION = 34;
OVERLAY_PROTOCOL_MIN_VERSION = 33;
OVERLAY_PROTOCOL_VERSION = 35;

VERSION_STR = STELLAR_CORE_VERSION;

Expand Down Expand Up @@ -261,7 +261,6 @@ Config::Config() : NODE_SEED(SecretKey::random())
PEER_FLOOD_READING_CAPACITY_BYTES = 0;
FLOW_CONTROL_SEND_MORE_BATCH_SIZE_BYTES = 0;
OUTBOUND_TX_QUEUE_BYTE_LIMIT = 1024 * 1024 * 3;
ENABLE_FLOW_CONTROL_BYTES = true;

// WORKER_THREADS: setting this too low risks a form of priority inversion
// where a long-running background task occupies all worker threads and
Expand Down Expand Up @@ -1031,10 +1030,6 @@ Config::processConfig(std::shared_ptr<cpptoml::table> t)
FLOW_CONTROL_SEND_MORE_BATCH_SIZE_BYTES =
readInt<uint32_t>(item, 1);
}
else if (item.first == "ENABLE_FLOW_CONTROL_BYTES")
{
ENABLE_FLOW_CONTROL_BYTES = readBool(item);
}
else if (item.first == "OUTBOUND_TX_QUEUE_BYTE_LIMIT")
{
OUTBOUND_TX_QUEUE_BYTE_LIMIT = readInt<uint32_t>(item, 1);
Expand Down
5 changes: 0 additions & 5 deletions src/main/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,6 @@ class Config : public std::enable_shared_from_this<Config>
uint32_t PEER_FLOOD_READING_CAPACITY_BYTES;
uint32_t FLOW_CONTROL_SEND_MORE_BATCH_SIZE_BYTES;

// Enable flow control in bytes. This config allows core to process large
// transactions on the network more efficiently and apply back pressure if
// needed.
bool ENABLE_FLOW_CONTROL_BYTES;

// Byte limit for outbound transaction queue.
uint32_t OUTBOUND_TX_QUEUE_BYTE_LIMIT;

Expand Down
Loading

0 comments on commit ec3c8e8

Please sign in to comment.