naemon / naemon-core

Networks, Applications and Event Monitor
http://www.naemon.io/
GNU General Public License v2.0
151 stars 63 forks source link

Rework comment handling #420

Closed sni closed 1 year ago

sni commented 1 year ago

rework comment handling

This PR reworks the comment handling to improve performance when having lots of comments.

In general, it tries to adopt the downtime handling over to comments.

This PR is based on and includes #375.

Since the internal object structure changes, all NEB modules have to be rebuild. (We therefor increase CURRENT_NEB_API_VERSION to 6)

Signed-off-by: Sven Nierlein sven@consol.de

jdumalaonITRS commented 1 year ago

Hi, Not sure if I missed something but doesn't it look like we need the comment_list even less? We can still have the host/service attribute which holds links to the comments and have a hashtable.

I am just not 100% sure what needs to happen for the sorting code for comment_list though. Does anyone know why we need to sort?

sni commented 1 year ago

I assumed the comment_list is required for livestatus, but i did a quick search and did not find any reference. It seems like comments are soley add/removed from broker callbacks. I can try to remove it completely. And if it's removed, we don't have to order it.

sni commented 1 year ago

Alright, i completely removed the comments_list now.

jdumalaonITRS commented 1 year ago

Nice thanks for this. The code looks good. Let me try some manual tests for this. I'll try to feedback by next week.

nook24 commented 1 year ago

I have tested this with 400k comments, works as promised.

[0.0079 (+0.0000)] Initialized retention data
[0.0079 (+0.0000)] Reading initial state information
[2.4028 (+2.3948)] Read initial state information
[2.4029 (+0.0002)] Restored 0 downtimes
[2.4029 (+0.0000)] Restored 400000 comments
[2.4030 (+0.0000)] Initializing performance data