-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Performance degradation in SpEL expression evaluation [SPR-16942] #21481
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
Comments
Christoph Dreis commented Hi, I noticed this as well recently. The caching solution in #21421 helps only in situations were the ReflectivePropertyAccessor and/or EvaluationContext is not created over and over again. Spring Security`s WebExpressionVoter or more specifically AbstractSecurityExpressionHandler is creating a StandardEvaluationContext with a fresh ReflectivePropertyAccessor every time for example and thus not benefitting much of the cache. I therefore wonder if we should additionally look at the call-sites and enhance them if possible - similar to what the framework does in some of the annotation relevant code in order to prevent the costly checks in AnnotationUtils or AnnotatedElementUtils. |
Juergen Hoeller commented Christoph Dreis, it is definitely recommended to reuse So please report any such obvious cases to the corresponding projects if they are not aware of it already. |
Christoph Dreis commented I figured already - hence the comment. See it as an addendum to the work that might be done in the Framework itself, which I think is still necessary. But I believe the projects that make use of it are able to optimize the calls themselves as well. I'll let you know once I created the issue(s) in the respective projects. |
Hi @spring-issuemaster, |
@spring-issuemaster Any update please? Thanks. |
With #31617 being implemented now, we no longer see this issue as actionable. Please give Spring Framework 6.1.x a try. If you're still experiencing performance issue, a new issue with additional details is more than welcome. Thanks! |
Kanthi Vaidya opened SPR-16942 and commented
We are planning to move from Spring 4.3.6 to Spring 5. We noticed a considerable dip in performance. About 50% degradation.
#21421 talks about a specific hot spot. Please look at attached benchmarks in that JIRA.
Juergen, I saw your code changes for caching the SortedMethods. We don't benefit much if you don't make your ConcurrentHashMap of sorted methods a static variable.
Even after making the ConcurrentHashMap a static variable, we still don't get back the original performance of the prior spring versions. It definitely helps of course.
This is just one hotspot. More benchmarking and profiling is needed to identify other hot spots. And it probably makes sense to add a test case to the CI infrastructure to catch any such degradations.
This performance degradation, is preventing us from migration to Spring 5.
Affects: 5.0.7
Issue Links:
0 votes, 5 watchers
The text was updated successfully, but these errors were encountered: