spring-projects / spring-projects/spring-session
Reduce allocations from Redis operations
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 1.2k
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 55
Description
RedisIndexedSessionRepository and RedisSessionExpirationPolicy create a lot of single-use proxies by relying on BoundHashOperations.
For instance in this case:
This showed up in our production profiler because of hundreds of MB allocated in java.lang.reflect.Method:
If I understand the code correctly, this is done purely for convenience and could simply be replaced by the following code:
String key = getSessionKey(sessionId);
sessionRedisOperations.opsForHash().putAll(key, this.delta);
Or am I overlooking something?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with RedisIndexedSessionRepository.java at the referenced lines 733-735 and 898-903, then inspect RedisSessionExpirationPolicy for the same BoundHashOperations usage. Compare the direct Redis operations with the current behavior and verify that the change removes unnecessary allocations without altering session updates or expiration handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, redis, spring
- Domain
- backend, performance
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100