Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Improve evaluation performance #1453

Open
3 tasks
beeme1mr opened this issue Nov 20, 2024 · 6 comments
Open
3 tasks

[FEATURE] Improve evaluation performance #1453

beeme1mr opened this issue Nov 20, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@beeme1mr
Copy link
Member

beeme1mr commented Nov 20, 2024

Overview

The flag evaluation engine in flagd leverages JsonLogic to provide a powerful and flexible rule-based serializable logic. The flagd binary and in-process Go flagd provider use this library. To improve flag evaluation performance and reduce computational overhead, the ruleset should be pre-decoded when a flag set is loaded (or updated). This removes the need to parse the JsonLogic structure for each evaluation.

Tasks

Preview Give feedback

This should be a non-breaking change in the Go JsonLogic SDK.

@beeme1mr beeme1mr added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Nov 20, 2024
@aasifkhan7
Copy link

I'd like to work on this one @beeme1mr ! Could you please assign it to me?

@aasifkhan7
Copy link

@beeme1mr To confirm, should this change be made in the repository at https://github.com/diegoholiveira/jsonlogic?

@toddbaert
Copy link
Member

@beeme1mr To confirm, should this change be made in the repository at https://github.com/diegoholiveira/jsonlogic?

No, what @beeme1mr was getting at is that we parse and compile the JSON rules every time we evaluate (here). We can instead only do this when the rules are first retrieved.

@beeme1mr please correct if I'm wrong

Assigning you, @aasifkhan7

@beeme1mr
Copy link
Member Author

@aasifkhan7 is correct that the JSON Logic implementation in Go must be updated to support this feature first. Once that's in place, we need to update flagd to leverage it.

@aasifkhan7
Copy link

@beeme1mr @toddbaert Should it be the responsibility of the jsonlogic library to cache and store the decoded rule for subsequent evaluations? Or should the responsibility for caching and storing the decoded rule lie with the third-party application, such as flagd?

What are your thoughts on the best approach for handling this?

@beeme1mr
Copy link
Member Author

Hey @aasifkhan7, I propose that the JSON Logic library support a built step similar to what you see here. This would allow you to "hydrate" the JSON Logic engine during initiation instead of at evaluation time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants