-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[WLM] Automated labeling of search requests #16797
Comments
@froh @reta @jainankitk @backslasht @andrross |
If we want to separate out the rules for features then having limited choice based value for additional field mentioning which feature would use the rule. the schema could look like following
|
Thanks @kaushalmahi12 (sorry for the delay).
I think this is the right approach to manage rules. Also, I suspect the labeling (rule matching) should only be applied on coordinator node(s)? Regarding the data structures, I think it would be great to understand how exactly the attributes to match against are extracted from the search requests, do we have an RFC/Feature Request for it? (sorry if I missed it) |
Thanks @reta for looking into it.
Not sure if I follow completely but IMO the mapping should be 1:1 from a user level request and how we treat it within the system. With that being said maybe |
Is your feature request related to a problem? Please describe
Recently we launched WLM subfeature i,e; multitenant search resiliency. But the feature still required an external hint to be sent along with each request via HTTP header. Hence this approach puts the burden on the user to apply these hints intelligently.
This can become a real pain if the access is programmatic and if not planned properly the programmatic multitenant access can become unmanageable. Hence it would rather be great if user could just define some rules to determine what should be the right tenant for certain class (confirms to a rule) of request.
Though we have touch based on this idea in the following RFCs
In this issue I want to go over the high level approach to achieve this.
Describe the solution you'd like
Given that this tagging component will lie directly on the search path, we will keep efficient in memory snapshot of the rules for faster processing. The label assignment will only happen once for a request at co-ordinator node irrespective of number of shards it is going to hit.
Rules schema and Storage options
Rule Schema
In-memory Structure for Rules
Since we want to hold all the rules in memory and do a fast prefix based string matching trie data structure becomes a natural choice for this problem.
We will keep per attribute trie in memory, each trie will give us a possible list of matching labels.
Rules storage
Following diagram illustrates the rules storage process and how does the structure evolves over time on incremental rule additions [Note: in the diagrams I have used query groups but this will be a generic label which other features can also use]
Rules Matching
Given that the rules are stored in in-memory trie data structure, single attribute value match could yield multiple results. Now there are following scenarios for the string search in the trie
Now given these N lists of matches, 1 per attribute. We can select an item which will appear in most number of lists and if there is a tie then pick the one with shortest depth in the tree. If the match results in a tie even with depth as a param we will use first query group from the list lexicographically.
Related component
Search
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: