NMS-20032: implement a postgresql-based Flows feature#8639
Open
dino2gnt wants to merge 16 commits into
Open
Conversation
… flow persistence, while still allowing Kafka persistence to forward if configured; make everything coexist
dino2gnt
requested review from
cgorantla,
christianpape,
indigo423 and
marshallmassengill
July 17, 2026 18:36
… isn't commited anywhere yet); clarify purpose
cgorantla
requested review from
christianpape
and removed request for
christianpape
July 20, 2026 02:39
marshallmassengill
previously approved these changes
Jul 20, 2026
marshallmassengill
left a comment
Contributor
There was a problem hiding this comment.
I gave some feedback which Dino implemented over the weekend. Overall I think this is good but it's probably worth a discussion before we merge it just to make sure we've covered our bases.
… backend implementation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 implements a PostgreSQL-based
flowsfeature, mimicking the functionality of and implementing the same features asfeatures/flows/elastic, including aPostgresFlowRepositoryandPostgresFlowQueryService. ThePostgresFlowQueryServicebakes in the proportional sum aggregation currently packaged for Elasticseach as Drift.It supports both "internal" and "external" databases and the feature is loadable on Sentinel, targeting an external database for offload.
The table schema is fairly simple and uses PostgreSQL native partitioning:
On a Core instance, partition creation and expiration is managed by
vacuumd. On an external database,pg_partmanandpg_cronare recommended.In my testing, I was able to scale this to ~15,000 flow documents a second with only the tunables suggested by pgtune.leopard.in.ua.
Testing environment consisted of:
10c / 16G PostgreSQL 18:
6c / 6g OpenNMS
There is some OSGi magic here to allow the PostgreSQL feature to supersede the Elasticsearch feature so the two don't load together that I don't claim to understand, I wanted to be able to specify the
opennms-flows-postgresfeature only and not have the two features conflict.Assisted by Anthropic Claude Opus 4.8
External References