-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Optimize session resolution in SessionRepositoryFilter #1048
Comments
Thanks for the report @cemo. Why do you think the That being said, I see your point with multiple retrieval of session as a part of |
Sorry @vpavic. I did not mean buggy. In fact it has some performance issues. I think it can cache session in |
Thanks for clarification @cemo. I think the |
Thanks @vpavic. Please let me know after you optimized it. I can test for you. |
Please also note that it was called not only beginning of the request. At the end of request lifecycle it was called again multiple times.
|
@cemo I've pushed some WIP changes in #1050. This should optimize things a bit by not using It seems that If you can give these changes a shot, that would be great. |
@vpavic I will give a try but I think that we have a fundamental mistake. from javax.servlet.http.HttpServletRequest#getRequestedSessionId:
I think validating it by fetching from repository may not be correct behaviour. This might be better to be addressed in I will also others implementation as well and let you know. |
As I guessed, it has fixed behaviour. Please see imlementation: And It has set only from SessionHandler in without checking its validity. Please let me know what do you think? |
The thing is that |
I see your point. I have double checked Jetty's implementation. They addressed same concern by setting They are iterating all cookies and after a successful match they break the loop and than trying to set at the end of the method both |
Dear @vpavic, is there a due date for 2.0.3? |
We don't have any dates set yet, we'll update the milestones page when we do. |
@vpavic I think that this issue has not resolved by this commit. Should I open another one? I had written my findings at 7513753#r28863608 |
Please do as both closed issues and commit comments are not ideal places to discuss further improvements in this area. |
We are using JDBCSessionRepository and started to profile our application. On line 303 and 306 session is fetched twice:
spring-session/spring-session-core/src/main/java/org/springframework/session/web/http/SessionRepositoryFilter.java
Lines 303 to 313 in d97ad2c
Here is the relevant
getRequestedSessionId
part.spring-session/spring-session-core/src/main/java/org/springframework/session/web/http/SessionRepositoryFilter.java
Lines 354 to 361 in d97ad2c
@vpavic I think this is a regression since I do not remember twice select before.
The text was updated successfully, but these errors were encountered: