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

perf: add concurrency and pipeline for redis cache #1338

Merged

Conversation

rfyiamcool
Copy link
Contributor

@rfyiamcool rfyiamcool commented Nov 4, 2023

summary

  1. 增加 enablePipeline 配置,用户可以选配来开启 redis pipeline 模式. go-redis 库包是支持在集群模式下,pipeline 下不同key 的拆离并发操作,但这毕竟是 sdk 层实现,对于容错的处理有限,多数场景是够用了。
  2. 当不开启 pipeline 模式下,以前为串行同步执行逻辑,现在为有限并发模式,内部通过索引使其返回结果有序。
  3. 补全了这两个方法集的单元测试。

暂时先写 set/get 这两个方法,后面有空继续优化。😁

Signed-off-by: rfyiamcool <rfyiamcool@163.com>
Signed-off-by: rfyiamcool <rfyiamcool@163.com>
Signed-off-by: rfyiamcool <rfyiamcool@163.com>
Copy link
Contributor

sweep-ai bot commented Nov 4, 2023

Apply Sweep Rules to your PR?

  • Apply: All new business logic should have corresponding unit tests.
  • Apply: Refactor large functions to be more modular.

Copy link

codecov bot commented Nov 4, 2023

Codecov Report

Merging #1338 (16a3193) into main (62e9980) will increase coverage by 1.68%.
Report is 1 commits behind head on main.
The diff coverage is 64.58%.

@@           Coverage Diff            @@
##            main   #1338      +/-   ##
========================================
+ Coverage   2.41%   4.10%   +1.68%     
========================================
  Files         13      22       +9     
  Lines        786    2120    +1334     
========================================
+ Hits          19      87      +68     
- Misses       764    2028    +1264     
- Partials       3       5       +2     
Files Coverage Δ
pkg/common/db/cache/msg.go 17.80% <64.58%> (ø)

... and 8 files with indirect coverage changes

@cubxxw cubxxw added this pull request to the merge queue Nov 13, 2023
Merged via the queue into openimsdk:main with commit 2496a16 Nov 13, 2023
19 checks passed
@github-actions github-actions bot added this to the v3.1 milestone Nov 13, 2023
@openimsdk openimsdk locked and limited conversation to collaborators Nov 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants