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

Reduces overhead of RedisClusterNode.forEachSlot #2058

Merged
merged 1 commit into from Jul 1, 2022

Conversation

be-hase
Copy link
Contributor

@be-hase be-hase commented Mar 18, 2022

While investigating this issue (#2045), I discovered a minor performance issue.

Current RedisClusterNode.forEachSlot calls BitSet.length every time it loops.
The overhead here seems to be big. Please see the framegraph as follows.

image

We can reduce the overhead by calling BitSet.length only once.
When measured with JMH, you can see that the throughput(of RedisClusterNode.forEachSlot) is improved.

Benchmark                                            Mode  Cnt       Score      Error  Units
RedisClusterNodeBenchmark.originalRedisClusterNode  thrpt   25   62364.605 ± 1167.717  ops/s <-- Before
RedisClusterNodeBenchmark.updatedRedisClusterNode   thrpt   25  100597.253 ±  705.268  ops/s <-- After

Make sure that:

  • You have read the contribution guidelines.
  • You have created a feature request first to discuss your contribution intent. Please reference the feature request ticket number in the pull request.
  • You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.

@mp911de mp911de added the type: enhancement A general enhancement label Mar 23, 2022
@mp911de
Copy link
Collaborator

mp911de commented Mar 23, 2022

Thanks. That makes a lot of sense.

@mp911de mp911de self-assigned this Mar 23, 2022
@mp911de mp911de merged commit 7a6b3eb into redis:main Jul 1, 2022
@mp911de mp911de added this to the 6.1.9.RELEASE milestone Jul 1, 2022
@mp911de
Copy link
Collaborator

mp911de commented Jul 1, 2022

Thank you for your contribution. That's merged and backported now.

@be-hase
Copy link
Contributor Author

be-hase commented Jul 1, 2022

thanks :)

@be-hase be-hase deleted the cache-slots-length branch July 1, 2022 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants