[release/6.0] Switch to interpreted client-evaluation in parameter extractor #31784
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Partial port of #29815
Fixes #31782
Description
As part of EF's LINQ query processing, we identify fragments of the query tree which can be client-evaluated, and evaluate them using a lambda delegate. The lambda is currently compiled rather than interpreted.
Customer impact
On high application load spikes, application memory usage may grow uncontrollably and performance may deteriorate to a point where only a restart is workable.
How found
Customer report on 7.0
Regression
No.
Testing
This is a performance-related change, and so regression testing isn't relevant.
Risk
Extremely small - this simply adds "preferInterpretation: true" to
Expression.Lambda<T>.Compile
. The lambda in question is only ever invoked once, so this can only help performance (including beyond the spike issue that this issue fixes).Note that this change was also merged for 8.0.0-preview.1 as part of #29815, and we've received no reports of trouble.