Performant Eval on CAC config #272
Replies: 2 comments 1 reply
-
[context."$clientId == 'cId1' && $platform == 'ios' && $scope == 'release'"] -> context_id1
Eval Approach -> Based on the given object value for eval , for each dimension value given we will find the list of context_ids, Problem -> Issue in this approach is that for such dimensions whose value is of enum , like lets say |
Beta Was this translation helpful? Give feedback.
-
@pratikmishra356 rather than a tree, a graph representation seems more efficient? For example:
Given this structure, we have mixed the dimensions and their values in traversal, it would be better to make it something like this: |
Beta Was this translation helpful? Give feedback.
-
Problem Statement : Improve CAC eval latency , currently it is linearly dependent on the number of contexts , goal is to come up with a representation of storing cac config file , so that latency for eval can be fast
Representation of contexts
(Assumption is that context will have onlyand
and==
operators)Current toml representation
[context."$clientIs == 'cId1' && $platform == 'android' && $scope == 'release'"]
[context."$clientIs == 'cId1' && $platform == 'ios' && $scope == 'cug'"]
[context."$clientIs == 'cId1' && $scope== 'release'"]
[context."$platform == 'web'"]
Tree Structure representation
Eval Approach : We can think of dimension with the highest weightage as root node (in this case its clientId), we will then traverse in tree according to the object value provided for eval, we will have to traverse along two branches one with the given value and other along NA branch ( NA means context which does not have that dimension in condition). In each dimension object , key will the context's value like
cId1
,android
and then again nested json structure . Each path to the override_val (or leaf node ) will represent a contextProblem: In this approach issue is that for a particular cac_config file , we should have knowledge of its dimensions and their weightage, as during tree traversal we should know in which order we have to patch the overrides,
then for each config version we should have versioning of dimension details also,
Solution: solution to the above problem is that instead of storing override_val , we could store the context_id itself and get all the contexts_ids which matches , then order them based on context's weightage and then patch
Beta Was this translation helpful? Give feedback.
All reactions