icinga2/lib/config
Alexander Aleksandrovič Klimov 51cdd593da
Don't unnecessarily shuffle items before config validation
Before ae693cb7e1 (#9577) we've repeatedly looped over all items in parallel like this:

while not types.done:
  for t in types:
    if not t.done and t.dependencies.done:
      with parallel(all_items, CONCURRENCY) as some_items:
        for i in some_items:
          if i.type is t:
            i.commit()

I.e. all items got distributed over CONCURRENCY threads, but not always equally. E.g. it was the hosts' turn, but only two threads got hosts and did all the work. The others didn't do actual work (due to the lack of hosts in their queue) which reduced the performance. c721c302cd (#6581) fixed it by shuffling all_items first. ae693cb7e1 (#9577) made the latter unnecessary by replacing the above algorithm with this:

while not types.done:
  for t in types:
    if not t.done and t.dependencies.done:
      with parallel(all_items[t], CONCURRENCY) as some_items:
        for i in some_items:
          if i.type is t:
            i.commit()

I.e. parallel() gets only items of type t, so all threads get e.g. hosts.
2024-02-19 14:26:06 +01:00
..
CMakeLists.txt Separately handle apply rules targetting only specific parent objects 2022-10-28 14:27:53 +02:00
activationcontext.cpp Fix file endings 2023-05-17 18:05:13 +02:00
activationcontext.hpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
applyrule-targeted.cpp ApplyRule::GetTarget*s(): support constant strings from variables 2023-12-13 16:02:50 +01:00
applyrule.cpp ApplyRule: Make `m_HasMatches` atomic 2022-11-28 14:13:58 +01:00
applyrule.hpp FilterUtility::GetFilterTargets(): don't run filter for specific object(s) for all objects 2023-12-13 16:02:50 +01:00
config_lexer.ll Make ConfigCompiler#m_LexBuffer a String 2020-01-21 13:38:59 +01:00
config_parser.yy ApplyRule::GetTargetTypes(): return by const ref not to malloc() 2022-10-19 13:43:51 +02:00
configcompiler.cpp CONTEXT: use << everywhere to unify usages 2022-11-30 11:06:51 +01:00
configcompiler.hpp Use std::mutex, not boost::mutex 2021-02-03 09:54:57 +01:00
configcompilercontext.cpp Fix file endings 2023-05-17 18:05:13 +02:00
configcompilercontext.hpp Deduplicate and stabilize fragile filesystem transactions 2023-01-27 12:03:56 +01:00
configfragment.hpp INITIALIZE_ONCE_WITH_PRIORITY: use enum for priority values 2023-01-18 15:57:27 +01:00
configitem.cpp Don't unnecessarily shuffle items before config validation 2024-02-19 14:26:06 +01:00
configitem.hpp Rename silent parameter of ConfigItem::ActivateItems() 2021-06-21 16:07:36 +02:00
configitembuilder.cpp Fix file endings 2023-05-17 18:05:13 +02:00
configitembuilder.hpp Replace std::shared_ptr<Expression> with Expression::Ptr 2019-10-21 17:10:51 +02:00
expression.cpp Fix file endings 2023-05-17 18:05:13 +02:00
expression.hpp Introduce DictExpression#GetExpressions() 2023-12-13 16:02:50 +01:00
i2-config.hpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
objectrule.cpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
objectrule.hpp Replace Copyright header with a short version, part I 2019-02-25 14:48:22 +01:00
vmops.hpp Replace std::shared_ptr<Expression> with Expression::Ptr 2019-10-21 17:10:51 +02:00