Increase performance of 'icinga2_object' #389
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR does the following:
Merge
icinga2_objects
in RAMObjects are now merged in memory instead of writing them to files and then merging them after the fact.
They are still separated into multiple files if decided by the user (e.g. every host could have their own file or all hosts could share the same file; the latter is more time efficient).
This yields a great performance increase (up to 80% time savings)
Drop the
order
parameterThe
order
parameter used in objects is no longer taken into account.If
order
is used inicinga2_objects
, there will be a deprecation warning. Other than that it will just be ignored for now (order of objects is now down through python sorting a list of dictionaries (objects) to keep idempotency).Change structure in
/var/tmp/icinga/
Since files are no longer assembled, the directory structure needed to change a bit.
If running the new approach in an old environment, the directory structure will not be correct. What is now being treated as a file path has been a directory path previously (
target_path.conf/
vs.target_path.conf
).Writing objects will fail!
There is an easy, one-time fix: Delete
/var/tmp/icinga/
once.This removes the old structure and makes room for the new one.
Side note: In the future we could get rid off writing to
/var/tmp/icinga
altogether since this was only used to have a place in which to assemble multiple files into new ones.