Browse Source

Add eviction_period and eviction_tick_time_check_period to TResponseKeeperConfig, rename max_eviction_busy_time to max_eviction_tick_time.

shakurov 1 year ago
parent
commit
66b6b5f610
3 changed files with 15 additions and 8 deletions
  1. 5 1
      yt/yt/core/rpc/config.cpp
  2. 8 0
      yt/yt/core/rpc/config.h
  3. 2 7
      yt/yt/core/rpc/response_keeper.cpp

+ 5 - 1
yt/yt/core/rpc/config.cpp

@@ -255,8 +255,12 @@ void TResponseKeeperConfig::Register(TRegistrar registrar)
 {
     registrar.Parameter("expiration_time", &TThis::ExpirationTime)
         .Default(TDuration::Minutes(5));
-    registrar.Parameter("max_eviction_busy_time", &TThis::MaxEvictionTickTime)
+    registrar.Parameter("eviction_period", &TThis::EvictionPeriod)
+        .Default(TDuration::Seconds(1));
+    registrar.Parameter("max_eviction_tick_time", &TThis::MaxEvictionTickTime)
         .Default(TDuration::MilliSeconds(10));
+    registrar.Parameter("eviction_tick_time_check_period", &TThis::EvictionTickTimeCheckPeriod)
+        .Default(1024);
     registrar.Parameter("enable_warmup", &TThis::EnableWarmup)
         .Default(true);
     registrar.Parameter("warmup_time", &TThis::WarmupTime)

+ 8 - 0
yt/yt/core/rpc/config.h

@@ -350,9 +350,17 @@ public:
     //! For how long responses are kept in memory.
     TDuration ExpirationTime;
 
+    //! How often an eviction tick is initiated. Eviction drops old responses
+    //! that need no longer be kept in memory.
+    TDuration EvictionPeriod;
+
     //! Maximum time an eviction tick can spend.
     TDuration MaxEvictionTickTime;
 
+    //! The number of responses to evict between checking whether the tick is
+    //! taking too long (longer than MaxEvictionTickTime).
+    int EvictionTickTimeCheckPeriod;
+
     //! If |true| then initial warmup is enabled. In particular, #WarmupTime and #ExpirationTime are
     //! checked against each other. If |false| then initial warmup is disabled and #WarmupTime is ignored.
     bool EnableWarmup;

+ 2 - 7
yt/yt/core/rpc/response_keeper.cpp

@@ -23,11 +23,6 @@ using NYT::FromProto;
 
 ////////////////////////////////////////////////////////////////////////////////
 
-static constexpr auto EvictionPeriod = TDuration::Seconds(1);
-static constexpr auto EvictionTickTimeCheckPeriod = 1024;
-
-////////////////////////////////////////////////////////////////////////////////
-
 class TResponseKeeper
     : public IResponseKeeper
 {
@@ -47,7 +42,7 @@ public:
         EvictionExecutor_ = New<TPeriodicExecutor>(
             Invoker_,
             BIND(&TResponseKeeper::OnEvict, MakeWeak(this)),
-            EvictionPeriod);
+            Config_->EvictionPeriod);
         EvictionExecutor_->Start();
 
         profiler.AddFuncGauge("/response_keeper/kept_response_count", MakeStrong(this), [this] {
@@ -361,7 +356,7 @@ private:
                 break;
             }
 
-            if (++counter % EvictionTickTimeCheckPeriod == 0) {
+            if (++counter % Config_->EvictionTickTimeCheckPeriod == 0) {
                 if (timer.GetElapsedTime() > Config_->MaxEvictionTickTime) {
                     YT_LOG_DEBUG("Response Keeper eviction tick interrupted (ResponseCount: %v)",
                         counter);