-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Currently, the OpenFeatureClient.evaluateFlag() method performs a complete context merge on every flag evaluation by calling mergeEvaluationContext(), which merges all four context levels from scratch: API context (global), Transaction context, Client context, Invocation context (evaluation-specific)
Problem: This bottom-up approach is inefficient because:
- API, transaction, and client contexts change infrequently compared to evaluation frequency
- Each evaluation recreates the same merged context for the stable upper levels
- Unnecessary object allocation and computation occurs on every evaluation
Proposed Solution: Implement a top-down context propagation system:
- API level: When API context changes, propagate to transaction level
- Transaction level: When transaction context changes, propagate to client level
- Client level: When client context changes, create pre-merged context (API + Transaction + Client)
- Evaluation: Only merge the pre-computed context with the invocation context
Benefits:
- Reduces object churn and GC pressure and improves performance in high-evaluation scenarios
- Enables better performance scaling for applications with many flag evaluations
The documentation should recommend setting contexts before creating clients to maximize caching benefits.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request