Skip to content

MID-10972 Improve login and self-dashboard performance#601

Open
kay1313 wants to merge 5 commits intomasterfrom
fix/MID-10972
Open

MID-10972 Improve login and self-dashboard performance#601
kay1313 wants to merge 5 commits intomasterfrom
fix/MID-10972

Conversation

@kay1313
Copy link
Copy Markdown
Contributor

@kay1313 kay1313 commented Apr 8, 2026

Overview

Improve login and self-dashboard performance by reducing redundant work during:

  • assignment evaluation
  • GUI profile compilation
  • dashboard rendering

Main techniques:

  • batching
  • caching
  • data pre-trimming

These changes reduce repeated repository calls and heavy wrapper initialization
while preserving existing behavior via fallback paths.


Make org-tree inOid batch size configurable

Introduced configurable batch size for org-tree inOid search (previously hardcoded).

  • property: midpoint.model.securityPolicy.orgTreeInOidBatchSize
  • default: 50
  • invalid values (< 1) fallback to default

Benefit: allows tuning org-tree traversal performance per deployment.


Add batched prefetch for login assignment targets

Batch-fetch assignment target objects during login-mode evaluation.

How it works:

  • collect direct assignment target references
  • group by type
  • fetch in batches from repository
  • pass prefetched targets to AssignmentEvaluator

Behavior:

  • fast-path used when OID + type are present
  • fallback to resolver if missing

Result: eliminates repeated per-assignment resolution calls during login.


Reuse resolved targets across assignment evaluation

Add evaluator-local cache of resolved targets (keyed by type + OID).

Behavior:

  • initialize cache from prefetched targets
  • check cache before resolving references
  • store single-result resolutions for reuse

Result: reduces repeated nested target resolution while keeping fallback behavior intact.


Avoid duplicate GUI profile collection (reuse login inputs)

Reuse GUI profile inputs collected during login instead of recomputing them.

Changes:

  • added LoginGuiProfileInputs to GuiProfiledPrincipal
  • store admin GUI configs + dependencies during login
  • reuse them in GuiProfileCompiler
  • clear after successful use

Result: removes duplicate GUI profile collection work.


Pre-trim assignments in self dashboard

Trim assignments before wrapper initialization to avoid unnecessary processing.

Scope:

  • applies only to assignment-backed dashboard widgets

How it works:

  • derive trim rules from supported panel types
  • reuse panel query/filter logic
  • apply filters before limiting
  • special handling for userAllAccesses

Behavior:

  • unsupported panels → no trimming (safe fallback)
  • non-assignment widgets unaffected

Result: removes assignment-wrapper hotspot from dashboard rendering.


Summary

These changes:

  • reduce redundant resolution work
  • minimize repository calls
  • avoid duplicate computations
  • significantly improve login and dashboard performance

All optimizations preserve correctness through existing fallback mechanisms.


Performance impact

Test scenarios:

  • Org: user with ~1000 org assignments
  • Role: user with ~1000 role assignments
  • Mixed: user with ~1000 roles + ~1000 orgs
  • Admin: typical user (small assignment set)

Results

Scenario Operation Before After
Org login 1.5 s 1.4 s
dashboard 30 s 1.5 s
dashb1 0.5 s 0.5 s
Role login 8 s 1.2 s
dashboard 30 s 1.6 s
dashb1 0.5 s 0.5 s
Mixed login 9.5 s 3 s
dashboard 58 s 3 s
dashb1 >1 s 0.5 s
Admin login 0.2 s 0.2 s
dashboard ~2 s ~2 s
dashb1 0.5 s 0.5 s

Notes

  • Significant improvements for users with large assignment sets (roles/orgs)
  • Dashboard rendering reduced from tens of seconds to ~1–3 seconds
  • Login time improved especially for role-heavy users
  • No noticeable impact for small users (expected)

@1azyman 1azyman self-requested a review April 9, 2026 12:57
Copy link
Copy Markdown
Member

@1azyman 1azyman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* Add documentation
    * New static methods seem to be unused (only via reflection api), short explanation would help - if we don’t find nicer solution
    * DashboardWidgetRuntimeInspector, AssignmentPanelRule, WidgetFocusTrimContribution, etc…
* Get rid of PageBase parameters where possible
    * Use MidpointApplication.get().getSomeSpringBean()
    * Use PrismContext.get()
* Move DashboardWidgetRuntimeInspector.trimFocus method to DashboardWidgetRuntimeInspector.TrimPlan and make it non-static
* Personally, I’m not happy about the reflection magic calling createAssignmentCustomizeQuery and contributeFocusTrimPlan, but I couldn’t figure out anything better yet
    * One idea is to create DashboardWidgetPanelRegistry where all panel classes will in static block register Function<AssignmentPanelRule, ObjectQuery> to a map with panelId and something similar for contributeFocusTrimPlan

String MIDPOINT_HOST_NAME_PROPERTY = "midpoint.hostName";
String MIDPOINT_HTTP_PORT_PROPERTY = "midpoint.httpPort";
String MIDPOINT_MODEL_SECURITY_POLICY_ORG_TREE_IN_OID_BATCH_SIZE_PROPERTY =
"midpoint.model.securityPolicy.orgTreeInOidBatchSize";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to change property name to midpoint.model.orgTreeSearchWidthBatchSize as it's related to model object resolver (right now only used for security policy search)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants