Skip to content

perf(cache): should delete multiple keys at once to reduce operations in Redis cache #6170

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

Merged
merged 1 commit into from
Oct 12, 2024

Conversation

git-hulk
Copy link
Contributor

@git-hulk git-hulk commented Oct 12, 2024

Summary

Currently, it will send multiple commands to Redis if there are more than
one key in BulkRemove. We can improve by sending them at once to reduce operations.


Important

Optimize Redis cache operations by modifying Remove and BulkRemove to delete multiple keys in a single command, reducing Redis operations.

  • Behavior:
    • Remove in redis.go now calls BulkRemove to delete a single key, optimizing the operation.
    • BulkRemove in redis.go modified to delete multiple keys in a single Redis command.
  • Error Handling:
    • Uses errors.Is for error comparison in Retrieve in redis.go.
  • Tests:
    • TestBulkRemove in redis_test.go updated to expect a single Del command for multiple keys.

This description was created by Ellipsis for f090886. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to f090886 in 20 seconds

More details
  • Looked at 56 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. pkg/query-service/cache/redis/redis_test.go:85
  • Draft comment:
    The Remove function now uses BulkRemove, which expects multiple keys. Update the test to reflect this change by expecting ExpectDel with a single-element slice.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment seems to be suggesting a change that has already been made in the diff. The test has been updated to use ExpectDel with multiple keys, which matches the functionality of BulkRemove. Therefore, the comment is redundant and not necessary.
    I might be missing some context about the Remove function's previous implementation, but the current test implementation seems correct based on the diff.
    The diff clearly shows that the test has been updated to use ExpectDel with multiple keys, which is consistent with the BulkRemove function's behavior.
    The comment is unnecessary because the test already reflects the change to use ExpectDel with multiple keys. It should be deleted.
2. pkg/query-service/cache/redis/redis.go:69
  • Draft comment:
    Avoid using inline styles in React components. Instead, use external stylesheets, CSS classes, or styled components. This comment applies to the Remove function and any other similar instances.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_VnROTeADvXjcaWaM


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@git-hulk git-hulk force-pushed the improve/cache-del-multi-keys branch from f090886 to cd4aa70 Compare October 12, 2024 06:32
@git-hulk git-hulk changed the title improve(cache): should delete multiple keys at once to reduce operations in Redis cache perf(cache): should delete multiple keys at once to reduce operations in Redis cache Oct 12, 2024
Copy link
Member

@srikanthccv srikanthccv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@srikanthccv srikanthccv merged commit 291b3ba into SigNoz:develop Oct 12, 2024
12 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants