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

Expressions executor caching #46903

Closed
2 tasks
streamich opened this issue Sep 30, 2019 · 4 comments
Closed
2 tasks

Expressions executor caching #46903

streamich opened this issue Sep 30, 2019 · 4 comments
Labels
Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:x-large Extra Large Level of Effort

Comments

@streamich
Copy link
Contributor

streamich commented Sep 30, 2019

  • Memoize result of functions given the same arguments
  • Allow functions to opt-out of memoization

Parent issue: #46909

@streamich streamich added 10sp Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) labels Sep 30, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch

@streamich streamich mentioned this issue Sep 30, 2019
20 tasks
@lukasolson lukasolson added loe:x-large Extra Large Level of Effort and removed 10sp labels Jul 21, 2020
@ppisljar
Copy link
Member

ppisljar commented Feb 10, 2021

we looked at expression executor caching and figured we would need to solve a couple of issues first:

1. cases where expression would not change, but we would actually be requesting new data

examples:

  • using datemath now (possible solution: non cachable function providing now)
  • something accessing uiSettings internally (possible solution: provide non cachable uiSettings function)

2. cases where expression would change, but the request would not

example:

  • changing label of a column (possible solution: allow functions to provide a function to determine if cache should be hit (instead of executor doing this internally)

3. working with search sessions

example:

  • in application we do something that triggers re-execution of expression. as expression figures out it doesn't need to do the data fetching part the request is never made and search collector will not put it in the session. (possible solution: support backgrounding expressions or support reporting of search ids from expressions (for the cached ones))

4. memory consumption
The problem is that we don't know what to cache and if we cache everything we will be using a lot of memory.

possible solutions:

  • cache just specific functions (the ones fetching data)
  • make user responsible for deciding what to cache (use variables!)

examples:

  • esaggs ... | addColumn | addColumn | addColumn | ..... | pie we wouldn't want to cache every step of inexpensive addColumn perations

@streamich
Copy link
Contributor Author

streamich commented Feb 10, 2021

Maybe when expression is run, the consumer could specify for how long data is cached.

expressions.createExecution('esaggs ... | render', {
  cacheDataFor: 60000,
})

And then the esaggs function can see if the user wants to cache data requests. Then the functions that want to support data caching, like esaags, could be wrapped into a higher order function.

let esaggs = /* ... */;

esaggs = withCachedDataSupport(esaggs);

export { esaggs };

@exalate-issue-sync exalate-issue-sync bot added impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:weeks and removed loe:x-large Extra Large Level of Effort labels Apr 20, 2021
@petrklapka petrklapka added 1 and removed 1 labels May 10, 2021
@exalate-issue-sync exalate-issue-sync bot added loe:x-large Extra Large Level of Effort and removed loe:weeks labels Nov 22, 2021
@ppisljar
Copy link
Member

ppisljar commented Aug 8, 2022

Thank you for contributing to this issue, however, we are closing this issue due to inactivity as part of a backlog grooming effort. If you believe this feature/bug should still be considered, please reopen with a comment.

@ppisljar ppisljar closed this as completed Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) impact:low Addressing this issue will have a low level of impact on the quality/strength of our product. loe:x-large Extra Large Level of Effort
Projects
None yet
Development

No branches or pull requests

5 participants