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

Nut driver enumerator optimize #682

Merged
merged 61 commits into from
Jan 20, 2024

Conversation

jimklimov
Copy link
Member

@jimklimov jimklimov commented Mar 29, 2019

Initial testing showed that, not too surprisingly, the honest full config parsing to get the device name for service instance is an overkill, especially on systems that monitor many power devices and parse such data all at once during startup. This particular issue can be addressed by caching the original device name into service properties, which can be inspected quickly - and only fall back to the original slower logic if no hits happened. This block of commits also includes updating of existing configurations made with earlier nut-driver-enumerator versions (which do not have those device section names saved into service instance properties).

Another big change here is relocation of some functionality from the CLI processing loop into routines, some of which are now used by other code inside the script.

And a few smaller typos and issues found over time while this was all tested in real life deployments.

CC @geraldguillaume also.

UPDATE: Note to self: I am sure there was some further development about optimizing the script, maybe in 42ity fork, but can't find it at the moment. I think it revolved around detecting BASH_VERSION and using bash arrays or hash-maps to store data, for some 30% boost in parser performance on platforms where it is possible.

…led to add a normally-named one because it already exists (clean it up and then add)
…sh the non-instance service (for global config)
… setter into smf_setSavedUniq() for other use-cases
…up --get-device-for-service processing where possible
…up --get-device-for-service processing where possible (typo fix)
…r faster --get-service-for-device processing
…ceName data to be consistent (ensuring it is is expensive and belongs elsewhere)
…and upslist_savednames_find_mismatch() to upgrade entries without saved names
…e) and get_device_for_service() into routines
…ssing() into single-run and daemonized modes, to update inconsistent configs
@jimklimov jimklimov requested review from clepple, aquette and zykh March 29, 2019 21:21
…ntionally not installed as PartOf/WantedBy anything, no auto-start
… of times we try to reload/restart nut-driver-enumerator-daemon.service
…(from non-daemonized origins) and we do forking
@jimklimov jimklimov marked this pull request as draft October 31, 2023 23:33
@jimklimov jimklimov marked this pull request as ready for review November 5, 2023 14:53
@jimklimov jimklimov marked this pull request as draft November 5, 2023 23:06
@AppVeyorBot
Copy link

@jimklimov jimklimov marked this pull request as ready for review December 1, 2023 14:27
@jimklimov jimklimov marked this pull request as draft December 1, 2023 14:30
@jimklimov jimklimov marked this pull request as ready for review January 19, 2024 23:13
@jimklimov jimklimov merged commit 6920f08 into networkupstools:master Jan 20, 2024
10 of 12 checks passed
@jimklimov jimklimov deleted the nut-enum-optimize branch January 20, 2024 16:50
jimklimov added a commit to jimklimov/nut that referenced this pull request Apr 19, 2024
…d parentheses to curly braces, so we still recognize NEW_CHECKSUM for nut-driver reloads [networkupstools#2410, fallout of networkupstools#682]

Signed-off-by: Jim Klimov <[email protected]>
@jimklimov jimklimov added the nut-driver-enumerator (NDE) nut-driver-enumerator (NDE) automates service management integration for NUT driver instances etc. label Apr 19, 2024
jimklimov added a commit to jimklimov/nut that referenced this pull request Apr 19, 2024
…ednames_find_missing() and upslist_savednames_find_mismatch() [networkupstools#682, networkupstools#2410]

* Document better
* Fix envvars used in queries
* Fix matching of TABCHAR

Signed-off-by: Jim Klimov <[email protected]>
jimklimov added a commit to jimklimov/nut that referenced this pull request Apr 19, 2024
…t_savednames_find_mismatch() is reserved for future features and is incomplete [networkupstools#682, networkupstools#2410]

Signed-off-by: Jim Klimov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nut-driver-enumerator (NDE) nut-driver-enumerator (NDE) automates service management integration for NUT driver instances etc. service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants