Skip to content

Commit

Permalink
Make block overloaded if dispatch queue processing limit is reached (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
SpyCheese authored Jul 23, 2024
1 parent 58ca7b4 commit 1b93728
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions validator/impl/collator-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class Collator final : public td::actor::Actor {
unsigned dispatch_queue_ops_{0};
std::map<StdSmcAddress, LogicalTime> last_dispatch_queue_emitted_lt_;
bool have_unprocessed_account_dispatch_queue_ = false;
bool dispatch_queue_total_limit_reached_ = false;
td::uint64 defer_out_queue_size_limit_;
td::uint64 hard_defer_out_queue_size_limit_;

Expand Down
26 changes: 16 additions & 10 deletions validator/impl/collator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3714,6 +3714,7 @@ bool Collator::process_dispatch_queue() {
}
++total_count;
if (total_count >= max_total_count[iter]) {
dispatch_queue_total_limit_reached_ = true;
break;
}
}
Expand Down Expand Up @@ -4660,7 +4661,21 @@ bool Collator::check_block_overload() {
<< " lt_delta=" << block_limit_status_->cur_lt - block_limit_status_->limits.start_lt
<< " size_estimate=" << block_size_estimate_;
auto cl = block_limit_status_->classify();
if (cl <= block::ParamLimits::cl_underload) {
if (cl >= block::ParamLimits::cl_soft || dispatch_queue_total_limit_reached_) {
std::string message = "block is overloaded ";
if (cl >= block::ParamLimits::cl_soft) {
message += PSTRING() << "(category " << cl << ")";
} else {
message += "(long dispatch queue processing)";
}
if (out_msg_queue_size_ > SPLIT_MAX_QUEUE_SIZE) {
LOG(INFO) << message << ", but don't set overload history because out_msg_queue size is too big to split ("
<< out_msg_queue_size_ << " > " << SPLIT_MAX_QUEUE_SIZE << ")";
} else {
overload_history_ |= 1;
LOG(INFO) << message;
}
} else if (cl <= block::ParamLimits::cl_underload) {
if (out_msg_queue_size_ > MERGE_MAX_QUEUE_SIZE) {
LOG(INFO)
<< "block is underloaded, but don't set underload history because out_msg_queue size is too big to merge ("
Expand All @@ -4669,15 +4684,6 @@ bool Collator::check_block_overload() {
underload_history_ |= 1;
LOG(INFO) << "block is underloaded";
}
} else if (cl >= block::ParamLimits::cl_soft) {
if (out_msg_queue_size_ > SPLIT_MAX_QUEUE_SIZE) {
LOG(INFO) << "block is overloaded (category " << cl
<< "), but don't set overload history because out_msg_queue size is too big to split ("
<< out_msg_queue_size_ << " > " << SPLIT_MAX_QUEUE_SIZE << ")";
} else {
overload_history_ |= 1;
LOG(INFO) << "block is overloaded (category " << cl << ")";
}
} else {
LOG(INFO) << "block is loaded normally";
}
Expand Down

0 comments on commit 1b93728

Please sign in to comment.