Skip to content

Commit b0cb7a3

Browse files
committed
Move MaxTxInFly to ICB (ydb-platform#27635)
1 parent 8716881 commit b0cb7a3

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

ydb/core/protos/config.proto

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1629,6 +1629,12 @@ message TImmediateControlsConfig {
16291629
MinValue: 8,
16301630
MaxValue: 4096,
16311631
DefaultValue: 256 }];
1632+
1633+
optional uint64 MaxTxInFly = 2 [(ControlOptions) = {
1634+
Description: "Maximum tx queue size for all tablets",
1635+
MinValue: 0,
1636+
MaxValue: 1000000,
1637+
DefaultValue: 10000 }];
16321638
}
16331639

16341640
message TDSProxyControls {

ydb/core/protos/memory_controller_config.proto

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,4 @@ message TMemoryControllerConfig {
2828

2929
optional float CompactionLimitPercent = 130 [default = 10];
3030
optional uint64 CompactionLimitBytes = 131;
31-
32-
optional uint64 MaxTxInFly = 132 [default = 10000];
3331
}

ydb/core/tablet_flat/flat_executor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,12 @@ TExecutor::TExecutor(
133133
, Time(TAppData::TimeProvider)
134134
, Owner(owner)
135135
, OwnerActorId(ownerActorId)
136-
, MaxTxInFly(AppData()->MemoryControllerConfig.GetMaxTxInFly())
137136
, Emitter(new TIdEmitter)
138137
, CounterEventsInFlight(new TEvTabletCounters::TInFlightCookie)
139138
, Stats(new TExecutorStatsImpl())
140139
, LogFlushDelayOverrideUsec(-1, -1, 60*1000*1000)
141140
, MaxCommitRedoMB(256, 1, 4096)
141+
, MaxTxInFly(10000, 0, 1000000)
142142
{}
143143

144144
TExecutor::~TExecutor() {
@@ -181,6 +181,7 @@ void TExecutor::Registered(TActorSystem *sys, const TActorId&)
181181
TString myTabletType = TTabletTypes::TypeToStr(Owner->TabletType());
182182
AppData()->Icb->RegisterSharedControl(LogFlushDelayOverrideUsec, myTabletType + "_LogFlushDelayOverrideUsec");
183183
AppData()->Icb->RegisterSharedControl(MaxCommitRedoMB, "TabletControls.MaxCommitRedoMB");
184+
AppData()->Icb->RegisterSharedControl(MaxTxInFly, "TabletControls.MaxTxInFly");
184185

185186
// instantiate alert counters so even never reported alerts are created
186187
GetServiceCounters(AppData()->Counters, "tablets")->GetCounter("alerts_pending_nodata", true);
@@ -4073,8 +4074,7 @@ void TExecutor::ForceSendCounters() {
40734074

40744075
float TExecutor::GetRejectProbability() const {
40754076
// Limit number of in-flight TXs
4076-
// TODO: make configurable
4077-
if (Stats->TxInFly > MaxTxInFly) {
4077+
if (Stats->TxInFly > ui64(MaxTxInFly)) {
40784078
HadRejectProbabilityByTxInFly = true;
40794079
return 1.0;
40804080
}
@@ -4110,7 +4110,7 @@ float TExecutor::GetRejectProbability() const {
41104110
}
41114111

41124112
void TExecutor::MaybeRelaxRejectProbability() {
4113-
if (HadRejectProbabilityByTxInFly && Stats->TxInFly <= MaxTxInFly ||
4113+
if (HadRejectProbabilityByTxInFly && Stats->TxInFly <= ui64(MaxTxInFly) ||
41144114
HadRejectProbabilityByOverload)
41154115
{
41164116
HadRejectProbabilityByTxInFly = false;

ydb/core/tablet_flat/flat_executor.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,6 @@ class TExecutor
385385
// Counts the number of times LeaseDuration was increased
386386
size_t LeaseDurationIncreases = 0;
387387

388-
const ui64 MaxTxInFly;
389-
390388
struct TLeaseCommit : public TIntrusiveListItem<TLeaseCommit> {
391389
using TByEndMap = std::multimap<TMonotonic, TLeaseCommit*>;
392390

@@ -501,6 +499,7 @@ class TExecutor
501499

502500
TControlWrapper LogFlushDelayOverrideUsec;
503501
TControlWrapper MaxCommitRedoMB;
502+
TControlWrapper MaxTxInFly;
504503

505504
TActorId BackupWriter;
506505

ydb/tests/olap/test_overloads.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import yatest.common
66
import ydb
77
import random
8+
import requests
89

910
from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator
1011
from ydb.tests.library.harness.kikimr_runner import KiKiMR
@@ -110,13 +111,13 @@ def _setup_ydb_rp(cls):
110111
logger.info(yatest.common.execute([ydb_path, "-V"], wait=True).stdout.decode("utf-8"))
111112
config = KikimrConfigGenerator(
112113
extra_feature_flags={"enable_olap_reject_probability": True},
113-
memory_controller_config={"max_tx_in_fly": 0},
114114
)
115115
cls.cluster = KiKiMR(config)
116116
cls.cluster.start()
117117
node = cls.cluster.nodes[1]
118118
cls.ydb_client = YdbClient(endpoint=f"grpc://{node.host}:{node.port}", database=f"/{config.domain_name}")
119119
cls.ydb_client.wait_connection(timeout=60)
120+
cls.mon_url = f"http://{node.host}:{node.mon_port}"
120121

121122
def get_row_count(self) -> int:
122123
return self.ydb_client.query(f"select count(*) as Rows from `{self.table_name}`")[0].rows[0]["Rows"]
@@ -208,8 +209,16 @@ def test_overloads_workload(self, writing_in_flight_requests_count_limit, writin
208209
logging.info(f"Count rows after insert {self.get_row_count()}")
209210
assert self.get_row_count() != 0
210211

212+
def tune_icb(self):
213+
response = requests.post(
214+
self.mon_url + "/actors/icb",
215+
data="TabletControls.MaxTxInFly=0"
216+
)
217+
response.raise_for_status()
218+
211219
def test_overloads_reject_probability(self):
212220
self._setup_ydb_rp()
221+
self.tune_icb()
213222

214223
table_path = f"{self.ydb_client.database}/table_for_test_overloads_reject_probability"
215224
self.ydb_client.query(

0 commit comments

Comments
 (0)