Skip to content

Comments

Dichotomic search to add agents with authd#890

Merged
awiddersheim merged 1 commit intoossec:masterfrom
wazuh:dichotomic-search
Jul 12, 2016
Merged

Dichotomic search to add agents with authd#890
awiddersheim merged 1 commit intoossec:masterfrom
wazuh:dichotomic-search

Conversation

@vikman90
Copy link
Contributor

This patch solves the issue #873, speeding up the agent ID assignation at ossec-authd by using dichotomic search.

Currently, when assigning a new ID, OSSEC tries to use 1, 2, etc, until it finds the first empty ID. For each attempt, it opens the keys file and goes through it. So, the algorithmic efficiency is O(n^2).

Since the assigned IDs are always correlative, this implementation guesses the first free ID by splitting the entire list of possible values and testing only the central number. This way it achieves a linear-logarithmic efficiency, O(n log n).

@awiddersheim awiddersheim merged commit 5f40cf6 into ossec:master Jul 12, 2016
@vikman90 vikman90 deleted the dichotomic-search branch July 13, 2016 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants