Skip to content

NIFI-15889 Cache Parameter Context name mapping to fix O(N_PG x N_PC^2) startup synchronization#11295

Open
venkateshwaracholan wants to merge 1 commit into
apache:mainfrom
venkateshwaracholan:NIFI-15889
Open

NIFI-15889 Cache Parameter Context name mapping to fix O(N_PG x N_PC^2) startup synchronization#11295
venkateshwaracholan wants to merge 1 commit into
apache:mainfrom
venkateshwaracholan:NIFI-15889

Conversation

@venkateshwaracholan
Copy link
Copy Markdown

@venkateshwaracholan venkateshwaracholan commented May 28, 2026

StandardParameterContextManager.getParameterContextNameMapping() rebuilt the full name-to-context map on every call. During startup synchronization, this method is called repeatedly while processing versioned Process Groups, so rebuilding the map can become expensive for flows with large numbers of Parameter Contexts.
This change maintains the name mapping incrementally so reads return a cached unmodifiable map.

Summary

NIFI-15889

Changes

  • Added an incremental nameIndex and cached unmodifiable name mapping in StandardParameterContextManager
  • Added setParameterContextName() so renames update the cached mapping consistently
  • Updated StandardVersionedComponentSynchronizer and StandardParameterContextDAO to rename Parameter Contexts through the manager
  • Preserved compatibility with a default ParameterContextManager.setParameterContextName() implementation
  • Covered ReferenceOnlyParameterContext replacement so placeholder names are removed from the index when replaced

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000
  • Pull request contains commits signed with a registered key indicating Verified status

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Local Validation

A temporary local JUnit timing harness was run on main and this branch with 5,000 Parameter Contexts and 5,000 repeated name lookups per sample.

  • main median: about 600 ms
  • NIFI-15889 median: about 0.29 ms
    These timings are local validation only, not JMH benchmark results. The primary improvement is avoiding repeated full-map rebuilds.

Build

  • Build completed using ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

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.

1 participant