Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConfigItem::CommitNewItems(): allow fast search of pending items by type #9577

Merged
merged 2 commits into from
Nov 23, 2022

Conversation

Al2Klimov
Copy link
Member

@Al2Klimov Al2Klimov commented Nov 9, 2022

closes #9554

Copy link
Contributor

@julianbrost julianbrost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good overall. (I think there room for quite some more improvement in this function, but not in this PR.)

lib/config/configitem.cpp Outdated Show resolved Hide resolved
tools/mkclass/classcompiler.cpp Show resolved Hide resolved
tools/mkclass/classcompiler.cpp Outdated Show resolved Hide resolved
@julianbrost julianbrost merged commit dd99a5a into master Nov 23, 2022
@icinga-probot icinga-probot bot deleted the ConfigItem-CommitNewItems branch November 23, 2022 11:35
@julianbrost julianbrost added this to the 2.14.0 milestone Nov 25, 2022
Al2Klimov added a commit that referenced this pull request Feb 19, 2024
Before ae693cb (#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. c721c30 (#6581) fixed it by shuffling all_items first. ae693cb (#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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants