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

Performance improvement for RedisSessionRepository #3083

Open
mshabunin77 opened this issue Jul 9, 2024 · 1 comment
Open

Performance improvement for RedisSessionRepository #3083

mshabunin77 opened this issue Jul 9, 2024 · 1 comment
Assignees
Labels
in: redis type: enhancement A general enhancement

Comments

@mshabunin77
Copy link

Describe the bug
First of all, it's not a bug. It's a possibility to improve performance by avoiding unnecessary deserialization in RedisOperations every time session is loaded from redis. In current implementation of RedisSessionRepository it is expected that RedisOperations converts byte arrays to objects which then are stored in MapSession and it's done for all attributes on every session load. Instead, this deserialization can be postponed and MapSession will store Supplier object the same way as it's done in JdbcIndexedSessionRepository. Same improvement can be applied to RedisIndexedSessionRepository.

To Reproduce

  1. Use RedisSessionRepository(real application pages or test)
  2. Make session attribute serialization/deserialization heavier - for instance, enable encryption - this will help to show the difference.
  3. Create 2 application pages(in test it can be just different set of attributes). The first one with bigger number of attributes(and bigger data), the second with, say, single small attribute.
  4. Compare latency of second page between original RedisSessionRepository and postponed deserialization in the next scenario:
  • Create a new session
  • Call the first page to populate all session attributes.
  • Call the second page.

Expected behavior
Implementation with postponed deserialization should provide better performance.

Sample

A link to a GitHub repository with a minimal, reproducible sample.

Reports that include a sample will take priority over reports that do not.
At times, we may require a sample, so it is good to try and include a sample up front.

@mshabunin77 mshabunin77 added status: waiting-for-triage An issue we've not yet triaged type: bug A general bug labels Jul 9, 2024
@marcusdacoregio marcusdacoregio self-assigned this Aug 6, 2024
@marcusdacoregio marcusdacoregio added type: enhancement A general enhancement in: redis and removed type: bug A general bug status: waiting-for-triage An issue we've not yet triaged labels Aug 6, 2024
@marcusdacoregio
Copy link
Contributor

Hi @mshabunin77, thanks for the report.

Are you able to provide a minimal sample where we can see the difference between the two pages? Ideally, it would be great if we have a modified implementation of RedisSessionRepository where it uses the Supplier approach to be able to compare them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: redis type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants