@@ -6,6 +6,25 @@ using namespace NYTree;
6
6
7
7
// //////////////////////////////////////////////////////////////////////////////
8
8
9
+ void THeapSizeLimitConfig::ApplyDynamicInplace (const TDynamicHeapSizeLimitConfigPtr& dynamicConfig)
10
+ {
11
+ UpdateYsonStructField (ContainerMemoryRatio, dynamicConfig->ContainerMemoryRatio );
12
+ UpdateYsonStructField (ContainerMemoryMargin, dynamicConfig->ContainerMemoryMargin );
13
+ UpdateYsonStructField (Hard, dynamicConfig->Hard );
14
+ UpdateYsonStructField (DumpMemoryProfileOnViolation, dynamicConfig->DumpMemoryProfileOnViolation );
15
+ UpdateYsonStructField (MemoryProfileDumpTimeout, dynamicConfig->MemoryProfileDumpTimeout );
16
+ UpdateYsonStructField (MemoryProfileDumpPath, dynamicConfig->MemoryProfileDumpPath );
17
+ UpdateYsonStructField (MemoryProfileDumpFilenameSuffix, dynamicConfig->MemoryProfileDumpFilenameSuffix );
18
+ }
19
+
20
+ THeapSizeLimitConfigPtr THeapSizeLimitConfig::ApplyDynamic (const TDynamicHeapSizeLimitConfigPtr& dynamicConfig) const
21
+ {
22
+ auto mergedConfig = CloneYsonStruct (MakeStrong (this ));
23
+ mergedConfig->ApplyDynamicInplace (dynamicConfig);
24
+ mergedConfig->Postprocess ();
25
+ return mergedConfig;
26
+ }
27
+
9
28
void THeapSizeLimitConfig::Register (TRegistrar registrar)
10
29
{
11
30
registrar.Parameter (" container_memory_ratio" , &TThis::ContainerMemoryRatio)
@@ -20,7 +39,7 @@ void THeapSizeLimitConfig::Register(TRegistrar registrar)
20
39
.Default (TDuration::Minutes (10 ));
21
40
registrar.Parameter (" memory_profile_dump_path" , &TThis::MemoryProfileDumpPath)
22
41
.Default ();
23
- registrar.Parameter (" emory_profile_dump_filename_suffix " , &TThis::MemoryProfileDumpFilenameSuffix)
42
+ registrar.Parameter (" memory_profile_dump_filename_suffix " , &TThis::MemoryProfileDumpFilenameSuffix)
24
43
.Default ();
25
44
26
45
registrar.Postprocessor ([] (THeapSizeLimitConfig* config) {
@@ -30,17 +49,45 @@ void THeapSizeLimitConfig::Register(TRegistrar registrar)
30
49
});
31
50
}
32
51
33
- TTCMallocConfigPtr TTCMallocConfig::ApplyDynamic (const TTCMallocConfigPtr& dynamicConfig) const
52
+ // //////////////////////////////////////////////////////////////////////////////
53
+
54
+ void TDynamicHeapSizeLimitConfig::Register (TRegistrar registrar)
34
55
{
35
- // TODO(babenko): fix this mess
36
- auto mergedConfig = CloneYsonStruct (dynamicConfig);
37
- mergedConfig->HeapSizeLimit ->MemoryProfileDumpPath = HeapSizeLimit->MemoryProfileDumpPath ;
38
- mergedConfig->Postprocess ();
39
- return mergedConfig;
56
+ registrar.Parameter (" container_memory_ratio" , &TThis::ContainerMemoryRatio)
57
+ .Default ();
58
+ registrar.Parameter (" container_memory_margin" , &TThis::ContainerMemoryMargin)
59
+ .Default ();
60
+ registrar.Parameter (" hard" , &TThis::Hard)
61
+ .Default ();
62
+ registrar.Parameter (" dump_memory_profile_on_violation" , &TThis::DumpMemoryProfileOnViolation)
63
+ .Default ();
64
+ registrar.Parameter (" memory_profile_dump_timeout" , &TThis::MemoryProfileDumpTimeout)
65
+ .Default ();
66
+ registrar.Parameter (" memory_profile_dump_path" , &TThis::MemoryProfileDumpPath)
67
+ .Default ();
68
+ registrar.Parameter (" memory_profile_dump_filename_suffix" , &TThis::MemoryProfileDumpFilenameSuffix)
69
+ .Default ();
40
70
}
41
71
42
72
// //////////////////////////////////////////////////////////////////////////////
43
73
74
+ TTCMallocConfigPtr TTCMallocConfig::ApplyDynamic (const TDynamicTCMallocConfigPtr& dynamicConfig) const
75
+ {
76
+ auto mergedConfig = CloneYsonStruct (MakeStrong (this ));
77
+ UpdateYsonStructField (mergedConfig->AggressiveReleaseThreshold , dynamicConfig->AggressiveReleaseThreshold );
78
+ UpdateYsonStructField (mergedConfig->AggressiveReleaseThresholdRatio , dynamicConfig->AggressiveReleaseThresholdRatio );
79
+ UpdateYsonStructField (mergedConfig->AggressiveReleaseSize , dynamicConfig->AggressiveReleaseSize );
80
+ UpdateYsonStructField (mergedConfig->AggressiveReleasePeriod , dynamicConfig->AggressiveReleasePeriod );
81
+ UpdateYsonStructField (mergedConfig->GuardedSamplingRate , dynamicConfig->GuardedSamplingRate );
82
+ UpdateYsonStructField (mergedConfig->ProfileSamplingRate , dynamicConfig->ProfileSamplingRate );
83
+ UpdateYsonStructField (mergedConfig->MaxPerCpuCacheSize , dynamicConfig->MaxPerCpuCacheSize );
84
+ UpdateYsonStructField (mergedConfig->MaxTotalThreadCacheBytes , dynamicConfig->MaxTotalThreadCacheBytes );
85
+ UpdateYsonStructField (mergedConfig->BackgroundReleaseRate , dynamicConfig->BackgroundReleaseRate );
86
+ mergedConfig->HeapSizeLimit ->ApplyDynamicInplace (dynamicConfig->HeapSizeLimit );
87
+ mergedConfig->Postprocess ();
88
+ return mergedConfig;
89
+ }
90
+
44
91
void TTCMallocConfig::Register (TRegistrar registrar)
45
92
{
46
93
registrar.Parameter (" aggressive_release_threshold" , &TThis::AggressiveReleaseThreshold)
@@ -69,5 +116,33 @@ void TTCMallocConfig::Register(TRegistrar registrar)
69
116
70
117
// //////////////////////////////////////////////////////////////////////////////
71
118
119
+ void TDynamicTCMallocConfig::Register (TRegistrar registrar)
120
+ {
121
+ registrar.Parameter (" aggressive_release_threshold" , &TThis::AggressiveReleaseThreshold)
122
+ .Default ();
123
+ registrar.Parameter (" aggressive_release_threshold_ratio" , &TThis::AggressiveReleaseThresholdRatio)
124
+ .Optional ();
125
+
126
+ registrar.Parameter (" aggressive_release_size" , &TThis::AggressiveReleaseSize)
127
+ .Default ();
128
+ registrar.Parameter (" aggressive_release_period" , &TThis::AggressiveReleasePeriod)
129
+ .Default ();
130
+ registrar.Parameter (" guarded_sampling_rate" , &TThis::GuardedSamplingRate)
131
+ .Default ();
132
+ registrar.Parameter (" profile_sampling_rate" , &TThis::ProfileSamplingRate)
133
+ .Default ();
134
+ registrar.Parameter (" max_per_cpu_cache_size" , &TThis::MaxPerCpuCacheSize)
135
+ .Default ();
136
+ registrar.Parameter (" max_total_thread_cache_bytes" , &TThis::MaxTotalThreadCacheBytes)
137
+ .Default ();
138
+ registrar.Parameter (" background_release_rate" , &TThis::BackgroundReleaseRate)
139
+ .Default ();
140
+
141
+ registrar.Parameter (" heap_size_limit" , &TThis::HeapSizeLimit)
142
+ .DefaultNew ();
143
+ }
144
+
145
+ // //////////////////////////////////////////////////////////////////////////////
146
+
72
147
} // namespace NYT::NTCMalloc
73
148
0 commit comments