diff options
author | kruall <kruall@ydb.tech> | 2023-05-04 12:54:21 +0300 |
---|---|---|
committer | kruall <kruall@ydb.tech> | 2023-05-04 12:54:21 +0300 |
commit | 4d22b22f07686cf87eba749dc5f6748a9a360dcd (patch) | |
tree | a575c33a1dfba43d4f0073b6c755460e0fb01a86 | |
parent | 78f806e7be5d2efc1b55499f646c0958abce058f (diff) | |
download | ydb-4d22b22f07686cf87eba749dc5f6748a9a360dcd.tar.gz |
Fix crushes with 2 cpu in autoconfig,
-rw-r--r-- | ydb/core/driver_lib/run/kikimr_services_initializers.cpp | 301 | ||||
-rw-r--r-- | ydb/tests/functional/autoconfig/test_actorsystem.py | 36 | ||||
-rw-r--r-- | ydb/tests/library/harness/kikimr_config.py | 4 |
3 files changed, 205 insertions, 136 deletions
diff --git a/ydb/core/driver_lib/run/kikimr_services_initializers.cpp b/ydb/core/driver_lib/run/kikimr_services_initializers.cpp index 561d7ad221..24c6a9018c 100644 --- a/ydb/core/driver_lib/run/kikimr_services_initializers.cpp +++ b/ydb/core/driver_lib/run/kikimr_services_initializers.cpp @@ -579,11 +579,12 @@ static TInterconnectSettings GetInterconnectSettings(const NKikimrConfig::TInter namespace { - enum class EPoolType : i8 { + enum class EPoolKind : i8 { System = 0, User = 1, Batch = 2, - IC = 3, + IO = 3, + IC = 4, }; struct TShortPoolCfg { @@ -599,116 +600,116 @@ namespace { constexpr i16 GRpcHandlersPerCompletionQueueInMaxPreparedCpuCase = 1000; constexpr i16 GRpcHandlersPerCompletionQueuePerCpu = GRpcHandlersPerCompletionQueueInMaxPreparedCpuCase / MaxPreparedCpuCount; - TShortPoolCfg ComputeCpuTable[MaxPreparedCpuCount + 1][4] { - { {0, 0}, {0, 0}, {0, 0}, {0, 0} }, // 0 - { {1, 1}, {0, 1}, {0, 1}, {0, 0} }, // 1 - { {1, 1}, {1, 2}, {0, 1}, {0, 1} }, // 2 - { {1, 2}, {1, 3}, {1, 1}, {0, 1} }, // 3 - { {1, 2}, {1, 4}, {1, 1}, {1, 2} }, // 4 - { {1, 3}, {2, 5}, {1, 1}, {1, 2} }, // 5 - { {1, 3}, {3, 6}, {1, 1}, {1, 2} }, // 6 - { {2, 4}, {3, 7}, {1, 2}, {1, 3} }, // 7 - { {2, 4}, {4, 8}, {1, 2}, {1, 3} }, // 8 - { {2, 5}, {4, 9}, {2, 3}, {1, 3} }, // 9 - { {2, 5}, {5, 10}, {2, 3}, {1, 3} }, // 10 - { {2, 6}, {6, 11}, {2, 3}, {2, 4} }, // 11 - { {2, 6}, {7, 12}, {2, 3}, {2, 5} }, // 12 - { {3, 7}, {7, 13}, {2, 3}, {2, 5} }, // 13 - { {3, 7}, {7, 14}, {2, 3}, {3, 6} }, // 14 - { {3, 8}, {8, 15}, {2, 4}, {3, 6} }, // 15 - { {3, 8}, {9, 16}, {2, 4}, {3, 6} }, // 16 - { {3, 9}, {10, 17}, {2, 4}, {3, 7} }, // 17 - { {3, 9}, {10, 18}, {3, 5}, {3, 7} }, // 18 - { {4, 10}, {10, 19}, {3, 5}, {4, 8} }, // 19 - { {4, 10}, {10, 20}, {3, 5}, {4, 8} }, // 20 - { {4, 11}, {11, 21}, {3, 5}, {4, 8} }, // 21 - { {4, 11}, {12, 22}, {3, 5}, {4, 9} }, // 22 - { {4, 12}, {13, 23}, {3, 6}, {4, 9} }, // 23 - { {4, 12}, {13, 24}, {3, 6}, {5, 10} }, // 24 - { {5, 13}, {13, 25}, {3, 6}, {5, 10} }, // 25 - { {5, 13}, {13, 26}, {4, 7}, {5, 10} }, // 26 - { {5, 14}, {14, 27}, {4, 7}, {5, 11} }, // 27 - { {5, 14}, {14, 28}, {4, 7}, {5, 11} }, // 28 - { {5, 15}, {15, 29}, {4, 8}, {6, 12} }, // 29 - { {5, 15}, {16, 30}, {4, 8}, {6, 12} }, // 30 - { {6, 18}, {16, 31}, {4, 8}, {6, 12} }, // 31 + TShortPoolCfg ComputeCpuTable[MaxPreparedCpuCount + 1][5] { + { {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} }, // 0 + { {1, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0} }, // 1 + { {1, 1}, {0, 2}, {0, 1}, {0, 0}, {1, 1} }, // 2 + { {1, 2}, {0, 3}, {1, 1}, {0, 0}, {1, 1} }, // 3 + { {1, 2}, {1, 4}, {1, 1}, {0, 0}, {1, 2} }, // 4 + { {1, 3}, {2, 5}, {1, 1}, {0, 0}, {1, 2} }, // 5 + { {1, 3}, {3, 6}, {1, 1}, {0, 0}, {1, 2} }, // 6 + { {2, 4}, {3, 7}, {1, 2}, {0, 0}, {1, 3} }, // 7 + { {2, 4}, {4, 8}, {1, 2}, {0, 0}, {1, 3} }, // 8 + { {2, 5}, {4, 9}, {2, 3}, {0, 0}, {1, 3} }, // 9 + { {2, 5}, {5, 10}, {2, 3}, {0, 0}, {1, 3} }, // 10 + { {2, 6}, {6, 11}, {2, 3}, {0, 0}, {2, 4} }, // 11 + { {2, 6}, {7, 12}, {2, 3}, {0, 0}, {2, 5} }, // 12 + { {3, 7}, {7, 13}, {2, 3}, {0, 0}, {2, 5} }, // 13 + { {3, 7}, {7, 14}, {2, 3}, {0, 0}, {3, 6} }, // 14 + { {3, 8}, {8, 15}, {2, 4}, {0, 0}, {3, 6} }, // 15 + { {3, 8}, {9, 16}, {2, 4}, {0, 0}, {3, 6} }, // 16 + { {3, 9}, {10, 17}, {2, 4}, {0, 0}, {3, 7} }, // 17 + { {3, 9}, {10, 18}, {3, 5}, {0, 0}, {3, 7} }, // 18 + { {4, 10}, {10, 19}, {3, 5}, {0, 0}, {4, 8} }, // 19 + { {4, 10}, {10, 20}, {3, 5}, {0, 0}, {4, 8} }, // 20 + { {4, 11}, {11, 21}, {3, 5}, {0, 0}, {4, 8} }, // 21 + { {4, 11}, {12, 22}, {3, 5}, {0, 0}, {4, 9} }, // 22 + { {4, 12}, {13, 23}, {3, 6}, {0, 0}, {4, 9} }, // 23 + { {4, 12}, {13, 24}, {3, 6}, {0, 0}, {5, 10} }, // 24 + { {5, 13}, {13, 25}, {3, 6}, {0, 0}, {5, 10} }, // 25 + { {5, 13}, {13, 26}, {4, 7}, {0, 0}, {5, 10} }, // 26 + { {5, 14}, {14, 27}, {4, 7}, {0, 0}, {5, 11} }, // 27 + { {5, 14}, {14, 28}, {4, 7}, {0, 0}, {5, 11} }, // 28 + { {5, 15}, {15, 29}, {4, 8}, {0, 0}, {6, 12} }, // 29 + { {5, 15}, {16, 30}, {4, 8}, {0, 0}, {6, 12} }, // 30 + { {6, 18}, {16, 31}, {4, 8}, {0, 0}, {6, 12} }, // 31 }; - TShortPoolCfg HybridCpuTable[MaxPreparedCpuCount + 1][4] { - { {0, 0}, {0, 0}, {0, 0}, {0, 0} }, // 0 - { {1, 1}, {0, 1}, {0, 1}, {0, 0} }, // 1 - { {1, 1}, {1, 2}, {0, 1}, {0, 1} }, // 2 - { {1, 2}, {1, 3}, {1, 1}, {0, 1} }, // 3 - { {1, 2}, {1, 4}, {1, 1}, {1, 2} }, // 4 - { {1, 2}, {2, 5}, {1, 1}, {1, 2} }, // 5 - { {1, 2}, {2, 6}, {1, 1}, {2, 2} }, // 6 - { {2, 3}, {2, 7}, {1, 2}, {2, 3} }, // 7 - { {2, 3}, {3, 8}, {1, 2}, {2, 3} }, // 8 - { {2, 4}, {3, 9}, {1, 2}, {3, 4} }, // 9 - { {3, 4}, {3, 10}, {1, 2}, {3, 4} }, // 10 - { {3, 5}, {4, 11}, {1, 2}, {3, 5} }, // 11 - { {3, 5}, {4, 12}, {1, 3}, {4, 5} }, // 12 - { {4, 6}, {4, 13}, {1, 3}, {4, 6} }, // 13 - { {4, 6}, {5, 14}, {1, 3}, {4, 6} }, // 14 - { {4, 7}, {5, 15}, {1, 3}, {5, 7} }, // 15 - { {5, 7}, {5, 16}, {1, 3}, {5, 7} }, // 16 - { {5, 8}, {6, 17}, {1, 4}, {5, 8} }, // 17 - { {5, 8}, {6, 18}, {1, 4}, {6, 8} }, // 18 - { {6, 9}, {6, 19}, {1, 4}, {6, 9} }, // 19 - { {6, 9}, {7, 20}, {1, 4}, {6, 9} }, // 20 - { {6, 10}, {7, 21}, {1, 4}, {7, 10} }, // 21 - { {7, 10}, {7, 22}, {1, 5}, {7, 10} }, // 22 - { {7, 11}, {8, 23}, {1, 5}, {7, 11} }, // 23 - { {7, 11}, {8, 24}, {1, 5}, {8, 11} }, // 24 - { {8, 12}, {8, 25}, {1, 5}, {8, 12} }, // 25 - { {8, 12}, {9, 26}, {1, 5}, {8, 12} }, // 26 - { {8, 13}, {9, 27}, {1, 6}, {9, 13} }, // 27 - { {9, 13}, {9, 28}, {1, 6}, {9, 13} }, // 28 - { {9, 14}, {10, 29}, {1, 6}, {9, 14} }, // 29 - { {9, 14}, {10, 30}, {1, 6}, {10, 14} }, // 30 - { {10, 15}, {10, 31}, {1, 6}, {10, 15} }, // 31 + TShortPoolCfg HybridCpuTable[MaxPreparedCpuCount + 1][5] { + { {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} }, // 0 + { {1, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0} }, // 1 + { {1, 1}, {0, 2}, {0, 1}, {0, 0}, {1, 1} }, // 2 + { {1, 2}, {0, 3}, {1, 1}, {0, 0}, {1, 1} }, // 3 + { {1, 2}, {1, 4}, {1, 1}, {0, 0}, {1, 2} }, // 4 + { {1, 2}, {2, 5}, {1, 1}, {0, 0}, {1, 2} }, // 5 + { {1, 2}, {2, 6}, {1, 1}, {0, 0}, {2, 2} }, // 6 + { {2, 3}, {2, 7}, {1, 2}, {0, 0}, {2, 3} }, // 7 + { {2, 3}, {3, 8}, {1, 2}, {0, 0}, {2, 3} }, // 8 + { {2, 4}, {3, 9}, {1, 2}, {0, 0}, {3, 4} }, // 9 + { {3, 4}, {3, 10}, {1, 2}, {0, 0}, {3, 4} }, // 10 + { {3, 5}, {4, 11}, {1, 2}, {0, 0}, {3, 5} }, // 11 + { {3, 5}, {4, 12}, {1, 3}, {0, 0}, {4, 5} }, // 12 + { {4, 6}, {4, 13}, {1, 3}, {0, 0}, {4, 6} }, // 13 + { {4, 6}, {5, 14}, {1, 3}, {0, 0}, {4, 6} }, // 14 + { {4, 7}, {5, 15}, {1, 3}, {0, 0}, {5, 7} }, // 15 + { {5, 7}, {5, 16}, {1, 3}, {0, 0}, {5, 7} }, // 16 + { {5, 8}, {6, 17}, {1, 4}, {0, 0}, {5, 8} }, // 17 + { {5, 8}, {6, 18}, {1, 4}, {0, 0}, {6, 8} }, // 18 + { {6, 9}, {6, 19}, {1, 4}, {0, 0}, {6, 9} }, // 19 + { {6, 9}, {7, 20}, {1, 4}, {0, 0}, {6, 9} }, // 20 + { {6, 10}, {7, 21}, {1, 4}, {0, 0}, {7, 10} }, // 21 + { {7, 10}, {7, 22}, {1, 5}, {0, 0}, {7, 10} }, // 22 + { {7, 11}, {8, 23}, {1, 5}, {0, 0}, {7, 11} }, // 23 + { {7, 11}, {8, 24}, {1, 5}, {0, 0}, {8, 11} }, // 24 + { {8, 12}, {8, 25}, {1, 5}, {0, 0}, {8, 12} }, // 25 + { {8, 12}, {9, 26}, {1, 5}, {0, 0}, {8, 12} }, // 26 + { {8, 13}, {9, 27}, {1, 6}, {0, 0}, {9, 13} }, // 27 + { {9, 13}, {9, 28}, {1, 6}, {0, 0}, {9, 13} }, // 28 + { {9, 14}, {10, 29}, {1, 6}, {0, 0}, {9, 14} }, // 29 + { {9, 14}, {10, 30}, {1, 6}, {0, 0}, {10, 14} }, // 30 + { {10, 15}, {10, 31}, {1, 6}, {0, 0}, {10, 15} }, // 31 }; - TShortPoolCfg StorageCpuTable[MaxPreparedCpuCount + 1][4] { - { {0, 0}, {0, 0}, {0, 0}, {0, 0} }, // 0 - { {1, 1}, {0, 1}, {0, 1}, {0, 0} }, // 1 - { {2, 2}, {0, 2}, {0, 1}, {0, 1} }, // 2 - { {1, 3}, {1, 3}, {1, 1}, {0, 1} }, // 3 - { {1, 4}, {1, 4}, {1, 1}, {1, 2} }, // 4 - { {2, 5}, {1, 5}, {1, 1}, {1, 2} }, // 5 - { {3, 6}, {1, 6}, {1, 1}, {1, 2} }, // 6 - { {4, 7}, {1, 7}, {1, 2}, {1, 3} }, // 7 - { {5, 8}, {1, 8}, {1, 2}, {1, 3} }, // 8 - { {5, 9}, {1, 9}, {1, 2}, {2, 4} }, // 9 - { {6, 10}, {1, 10}, {1, 2}, {2, 4} }, // 10 - { {6, 11}, {1, 11}, {2, 3}, {2, 4} }, // 11 - { {7, 12}, {1, 12}, {2, 3}, {2, 5} }, // 12 - { {8, 13}, {1, 13}, {2, 3}, {2, 5} }, // 13 - { {8, 14}, {1, 14}, {2, 3}, {3, 6} }, // 14 - { {9, 15}, {1, 15}, {2, 4}, {3, 6} }, // 15 - { {10, 16}, {1, 16}, {2, 4}, {3, 6} }, // 16 - { {11, 17}, {1, 17}, {2, 4}, {3, 7} }, // 17 - { {11, 18}, {1, 18}, {3, 5}, {3, 7} }, // 18 - { {11, 19}, {1, 19}, {3, 5}, {4, 8} }, // 19 - { {12, 20}, {1, 20}, {3, 5}, {4, 8} }, // 20 - { {13, 21}, {1, 21}, {3, 5}, {4, 8} }, // 21 - { {14, 22}, {1, 22}, {3, 6}, {4, 9} }, // 22 - { {15, 23}, {1, 23}, {3, 6}, {4, 9} }, // 23 - { {15, 24}, {1, 24}, {3, 6}, {5, 10} }, // 24 - { {16, 25}, {1, 25}, {3, 6}, {5, 10} }, // 25 - { {16, 26}, {1, 26}, {4, 7}, {5, 10} }, // 26 - { {17, 27}, {1, 27}, {4, 7}, {5, 11} }, // 27 - { {18, 28}, {1, 28}, {4, 7}, {5, 11} }, // 28 - { {18, 29}, {1, 29}, {4, 7}, {6, 12} }, // 29 - { {19, 30}, {1, 30}, {4, 8}, {6, 12} }, // 30 - { {20, 31}, {1, 31}, {4, 8}, {6, 12} }, // 31 + TShortPoolCfg StorageCpuTable[MaxPreparedCpuCount + 1][5] { + { {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0} }, // 0 + { {1, 1}, {0, 1}, {0, 1}, {0, 0}, {0, 0} }, // 1 + { {1, 2}, {0, 2}, {0, 1}, {0, 0}, {1, 1} }, // 2 + { {1, 3}, {0, 3}, {1, 1}, {0, 0}, {1, 1} }, // 3 + { {1, 4}, {1, 4}, {1, 1}, {0, 0}, {1, 2} }, // 4 + { {2, 5}, {1, 5}, {1, 1}, {0, 0}, {1, 2} }, // 5 + { {3, 6}, {1, 6}, {1, 1}, {0, 0}, {1, 2} }, // 6 + { {4, 7}, {1, 7}, {1, 2}, {0, 0}, {1, 3} }, // 7 + { {5, 8}, {1, 8}, {1, 2}, {0, 0}, {1, 3} }, // 8 + { {5, 9}, {1, 9}, {1, 2}, {0, 0}, {2, 4} }, // 9 + { {6, 10}, {1, 10}, {1, 2}, {0, 0}, {2, 4} }, // 10 + { {6, 11}, {1, 11}, {2, 3}, {0, 0}, {2, 4} }, // 11 + { {7, 12}, {1, 12}, {2, 3}, {0, 0}, {2, 5} }, // 12 + { {8, 13}, {1, 13}, {2, 3}, {0, 0}, {2, 5} }, // 13 + { {8, 14}, {1, 14}, {2, 3}, {0, 0}, {3, 6} }, // 14 + { {9, 15}, {1, 15}, {2, 4}, {0, 0}, {3, 6} }, // 15 + { {10, 16}, {1, 16}, {2, 4}, {0, 0}, {3, 6} }, // 16 + { {11, 17}, {1, 17}, {2, 4}, {0, 0}, {3, 7} }, // 17 + { {11, 18}, {1, 18}, {3, 5}, {0, 0}, {3, 7} }, // 18 + { {11, 19}, {1, 19}, {3, 5}, {0, 0}, {4, 8} }, // 19 + { {12, 20}, {1, 20}, {3, 5}, {0, 0}, {4, 8} }, // 20 + { {13, 21}, {1, 21}, {3, 5}, {0, 0}, {4, 8} }, // 21 + { {14, 22}, {1, 22}, {3, 6}, {0, 0}, {4, 9} }, // 22 + { {15, 23}, {1, 23}, {3, 6}, {0, 0}, {4, 9} }, // 23 + { {15, 24}, {1, 24}, {3, 6}, {0, 0}, {5, 10} }, // 24 + { {16, 25}, {1, 25}, {3, 6}, {0, 0}, {5, 10} }, // 25 + { {16, 26}, {1, 26}, {4, 7}, {0, 0}, {5, 10} }, // 26 + { {17, 27}, {1, 27}, {4, 7}, {0, 0}, {5, 11} }, // 27 + { {18, 28}, {1, 28}, {4, 7}, {0, 0}, {5, 11} }, // 28 + { {18, 29}, {1, 29}, {4, 7}, {0, 0}, {6, 12} }, // 29 + { {19, 30}, {1, 30}, {4, 8}, {0, 0}, {6, 12} }, // 30 + { {20, 31}, {1, 31}, {4, 8}, {0, 0}, {6, 12} }, // 31 }; i16 GetIOThreadCount(i16 cpuCount) { return (cpuCount - 1) / (MaxPreparedCpuCount * 2) + 1; } - TShortPoolCfg GetShortPoolChg(EPoolType pool, i16 cpuCount, TShortPoolCfg cpuTable[][4]) { + TShortPoolCfg GetShortPoolChg(EPoolKind pool, i16 cpuCount, TShortPoolCfg cpuTable[][5]) { i16 k = cpuCount / MaxPreparedCpuCount; i16 mod = cpuCount % MaxPreparedCpuCount; ui8 poolIdx = static_cast<i8>(pool); @@ -758,72 +759,100 @@ void TBasicServicesInitializer::InitializeServices(NActors::TActorSystemSetup* s scheduler->SetProgressThreshold(10'000); } - NKikimrConfig::TActorSystemConfig::TExecutor *executors[] = { - mutableSystemConfig->AddExecutor(), - mutableSystemConfig->AddExecutor(), - mutableSystemConfig->AddExecutor(), - mutableSystemConfig->AddExecutor(), - mutableSystemConfig->AddExecutor() - }; - mutableSystemConfig->SetIoExecutor(0); - auto *ioExecutor = executors[3]; - ioExecutor->SetType(NKikimrConfig::TActorSystemConfig::TExecutor::IO); - ioExecutor->SetThreads(GetIOThreadCount(cpuCount)); - ioExecutor->SetName("IO"); - ui16 poolCount = Min(5, cpuCount + 1); - ui32 executorIds[4] = {0, 1, 2, 4}; - TVector<TString> names = {"System", "User", "Batch", "IC"}; - TVector<ui32> priorities = {30, 20, 10, 40}; + TVector<TString> names = {"System", "User", "Batch", "IO", "IC"}; + TVector<ui32> priorities = {30, 20, 10, 0, 40}; + TVector<ui32> executorIds = {0, 1, 2, 3, 4}; + + auto *serviceExecutor = mutableSystemConfig->AddServiceExecutor(); + serviceExecutor->SetServiceName("Interconnect"); switch (cpuCount) { case 1: mutableSystemConfig->SetUserExecutor(1); mutableSystemConfig->SetSysExecutor(1); mutableSystemConfig->SetBatchExecutor(1); - names = {"Common"}; - priorities = {40,}; + mutableSystemConfig->SetIoExecutor(2); + serviceExecutor->SetExecutorId(1); + + poolCount = 2; + names = {"Common", "IO"}; + priorities = {40, 0}; + executorIds = {0, 0, 0, 1, 0}; break; case 2: mutableSystemConfig->SetUserExecutor(1); mutableSystemConfig->SetSysExecutor(1); mutableSystemConfig->SetBatchExecutor(1); - names = {"Common"}; - priorities = {40,}; + mutableSystemConfig->SetIoExecutor(2); + serviceExecutor->SetExecutorId(1); + poolCount = 2; + names = {"Common", "IO"}; + priorities = {40, 0}; + executorIds = {0, 0, 0, 1, 0}; break; case 3: mutableSystemConfig->SetUserExecutor(1); mutableSystemConfig->SetSysExecutor(1); mutableSystemConfig->SetBatchExecutor(2); - names = {"Common", "Batch", "IC"}; - priorities = {30, 10, 40,}; + mutableSystemConfig->SetIoExecutor(3); + serviceExecutor->SetExecutorId(4); + + poolCount = 4; + names = {"Common", "Batch", "IO", "IC"}; + priorities = {30, 10, 0, 40,}; + executorIds = {0, 0, 1, 2, 3}; break; default: mutableSystemConfig->SetUserExecutor(1); mutableSystemConfig->SetSysExecutor(2); mutableSystemConfig->SetBatchExecutor(3); + mutableSystemConfig->SetIoExecutor(4); + serviceExecutor->SetExecutorId(5); break; } - auto *serviceExecutor = mutableSystemConfig->AddServiceExecutor(); - serviceExecutor->SetServiceName("Interconnect"); - serviceExecutor->SetExecutorId(poolCount - 1); + + TVector<NKikimrConfig::TActorSystemConfig::TExecutor *> executors; + for (ui32 poolIdx = 0; poolIdx < poolCount; ++poolIdx) { + executors.push_back(mutableSystemConfig->AddExecutor()); + } auto &cpuTable = (mutableSystemConfig->GetNodeType() == NKikimrConfig::TActorSystemConfig::STORAGE ? StorageCpuTable : mutableSystemConfig->GetNodeType() == NKikimrConfig::TActorSystemConfig::COMPUTE ? ComputeCpuTable : HybridCpuTable ); - for (ui32 poolType = 0; poolType < poolCount - 1; ++poolType) { - TShortPoolCfg cfg = GetShortPoolChg(static_cast<EPoolType>(poolType), cpuCount, cpuTable); - auto *executor = executors[executorIds[poolType]]; + + for (ui32 poolIdx = 0; poolIdx < poolCount; ++poolIdx) { + auto *executor = executors[poolIdx]; + if (names[poolIdx] == "IO") { + executor->SetType(NKikimrConfig::TActorSystemConfig::TExecutor::IO); + executor->SetThreads(GetIOThreadCount(cpuCount)); + executor->SetName(names[poolIdx]); + continue; + } + EPoolKind poolKind = EPoolKind::System; + if (names[poolIdx] == "User") { + poolKind = EPoolKind::User; + } else if (names[poolIdx] == "Batch") { + poolKind = EPoolKind::Batch; + } else if (names[poolIdx] == "IC") { + poolKind = EPoolKind::IC; + } + TShortPoolCfg cfg = GetShortPoolChg(poolKind, cpuCount, cpuTable); + i16 threadsCount = cfg.ThreadCount; + if (poolCount == 2) { + threadsCount = cpuCount; + } executor->SetType(NKikimrConfig::TActorSystemConfig::TExecutor::BASIC); - executor->SetThreads(cpuCount == 2 ? 2 : cfg.ThreadCount); - executor->SetMaxThreads(cpuCount == 2 ? 2 : cfg.MaxThreadCount); - executor->SetPriority(priorities[poolType]); - executor->SetName(names[poolType]); - if (cpuCount == 1 || cpuCount == 2) { + executor->SetThreads(threadsCount); + executor->SetThreads(Max(cfg.MaxThreadCount, threadsCount)); + executor->SetPriority(priorities[poolIdx]); + executor->SetName(names[poolIdx]); + + if (names[poolIdx] == "Common") { executor->SetSpinThreshold(0); executor->SetTimePerMailboxMicroSecs(100); - } else if (poolType == poolCount - 2) { // IC pool + } else if (names[poolIdx] == "IC") { executor->SetSpinThreshold(10); executor->SetTimePerMailboxMicroSecs(100); executor->SetMaxAvgPingDeviation(500); diff --git a/ydb/tests/functional/autoconfig/test_actorsystem.py b/ydb/tests/functional/autoconfig/test_actorsystem.py new file mode 100644 index 0000000000..352c750662 --- /dev/null +++ b/ydb/tests/functional/autoconfig/test_actorsystem.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +import sys + + +from ydb.tests.library.harness.kikimr_cluster import kikimr_cluster_factory +from ydb.tests.library.harness.kikimr_config import KikimrConfigGenerator + + +def make_test_for_specific_actor_system(node_type, cpu_count): + class TestWithSpecificActorSystem(object): + @classmethod + def setup_class(cls): + actor_system_config = { + "node_type": node_type, + "cpu_count": cpu_count, + "use_auto_config": True + } + configuration = KikimrConfigGenerator(overrided_actor_system_config=actor_system_config) + cls.kikimr_cluster = kikimr_cluster_factory(configuration) + cls.kikimr_cluster.start() + + @classmethod + def teardown_class(cls): + cls.kikimr_cluster.stop() + + def test(self): + pass + + return TestWithSpecificActorSystem + + +for node_type in ("Compute", "Storage", "Hybrid"): + for cpu_count in range(1, 40): + test = make_test_for_specific_actor_system(node_type.upper(), cpu_count) + setattr(sys.modules[__name__], "TestWith%sNodeWith%dCpu" % (node_type, cpu_count), test) diff --git a/ydb/tests/library/harness/kikimr_config.py b/ydb/tests/library/harness/kikimr_config.py index fb1320e91c..e0f2034fc0 100644 --- a/ydb/tests/library/harness/kikimr_config.py +++ b/ydb/tests/library/harness/kikimr_config.py @@ -142,6 +142,7 @@ class KikimrConfigGenerator(object): enable_alter_database_create_hive_first=False, disable_iterator_reads=False, disable_iterator_lookups=False, + overrided_actor_system_config=None ): self._version = version self.use_log_files = use_log_files @@ -212,6 +213,9 @@ class KikimrConfigGenerator(object): self.yaml_config = load_default_yaml(self.__node_ids, self.domain_name, self.static_erasure, self.__additional_log_configs) + if overrided_actor_system_config: + self.yaml_config["actor_system_config"] = overrided_actor_system_config + if disable_iterator_reads: if "table_service_config" not in self.yaml_config: self.yaml_config["table_service_config"] = {} |