-
Notifications
You must be signed in to change notification settings - Fork 21
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
Improve performance of Icinga 2 API commands processed in bulk #721
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Al2Klimov
commented
Mar 1, 2023
nilmerg
requested changes
Jul 11, 2023
nilmerg
requested changes
Jul 28, 2023
nilmerg
changed the title
Render one (not X) Icinga 2 API command targeting X objects
Improve performance of Icinga 2 API commands processed in bulk
Aug 2, 2023
TestsTo do list
Instance/ToggleInstanceFeaturesForm.phpObject/AcknowledgeProblemForm.phpObject/AddCommentForm.phpObject/CheckNowForm.phpObject/DeleteCommentForm.phpObject/ScheduleServiceDowntimeForm.phpObject/DeleteDowntimeForm.phpObject/RemoveAcknowledgementForm.phpObject/ProcessCheckResultForm.phpObject/ToggleObjectFeaturesForm.phpObject/ScheduleCheckForm.phpObject/SendCustomNotificationForm.phpConclusionIt still works. |
nilmerg
approved these changes
Aug 10, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Let me explain how I came here in the first place.
While discussing removal of some deprecated features with @Thomas-Gelf he opted against removing the command pipe. He considered it faster than the Icinga 2 API for massive stuff submission. I thought: wait, we have one system which eventually does massive stuff submission via API – Icinga Web. I even actually did that while testing Icinga ack sync. And it was indeed slow. I asked myself: what could it already do by itself to do this faster? What does it do right now? While reverse-engineering this repo I came to the conclusion that it renders, sends and awaits commands one by one. I remembered that @yhabteab did somewhere something with PHP event loops and let him show me them. They could help me sending multiple commands concurrently. It turned out more complicated than I thought, but then I remembered something else. @julianbrost digged out than our API supports not only DSL filters and filter_vars which iterate over all objects. It also supports targeting a specific object by name. This repo already does this. But it supports targeting multiple specific objects by array of names as well. That's what I did here.
Now the command forms render at best exactly one Icinga 2 API action request targeting all selected objects at once, not one request per object. Commenting e.g. 500 hosts now takes 4s, not 40. For this now commands and forms always handle multiple objects by design. PHP generators everywhere don't permit the RAM to blow up. Delete*Command are now parts of the ObjectsCommand family.
TODO