-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
JedisCluster Pipeline 的支持? #865
Comments
这个issue非常专业,在我细看之前,我需要先提出一个问题。 jedis版本一般是不单独改的。spring、spring-boot、lettuce、jedis的版本我会保持一致,它们要改就一起改。spring需要哪个版本的jedis/lettuce可以看org.springframework.data:spring-data-redis的pom定义,虽然我不能决定用户使用哪个版本的spring,但如果使用jetcache的根pom中定义的版本,一定是问题最少的。此外,我还需要尽量适应广泛的spring版本,同一个版本的jetcache可以在多个spring版本下使用,具体可以查看docs目录下的兼容性文档。 所以jedis一定要升级版本吗?升级的话:
mvn运行的时候会根据jdk的版本决定用哪个版本的spring进行测试(也可以手工修改),有一些测试比如RedisSpringDataCacheTest也会探测运行时环境决定是否运行。 |
@areyouok 感谢您的耐心回复,我看了下,最新的 Spring Data Redis 也是不支持 JedisCluster 的 Pipeline 的 并且 Jedis 的版本变化是:
由于 3.2.0 正式版直接就到 5.0.x 了,因此维护一个和 Spring 不对齐的 4.4.0 版本可能会导致问题,那这样我们只能留在 4.3.2,并在 JetCache 下一个大版本迭代(需要同步更新 Spring、 Lettuce)的时候,才升级到 5.0.x 比较合适。 不过 4.3.2 也并不是没有支持 ClusterPipeline 的方案,我们只需要加一个 Wrapper 就可以, 我在 PR 里增加一个 Commit 来体现 |
最新版本我一般是这样确定的,先找一个最新的spring-boot稳定版本,然后看它的pom需要spring-framework的什么版本,以及它一来的spring data(不一定是最新的)对jedis/lettuce的版本要求。 这些都是可以升级的,只是升级以后需要的检查项比较多。 |
假如 JetCache 的 2.8.0 以下一个正式版本的 Spring(3.2.0 开始), spring data redis 的版本是同步于 spring-boot 的: Lines 203 to 207 in 94c5a19
需要变动的大概是上面这几个依赖那么有两种可选方案, 来自于:
<spring.framework.version>6.1.0</spring.framework.version>
<spring.boot.version>3.2.0</spring.boot.version>
<lettuce.version>6.3.0.RELEASE</lettuce.version>
<jedis.version>5.0.2</jedis.version> 或者最新的:
<spring.framework.version>6.1.5</spring.framework.version>
<spring.boot.version>3.2.4</spring.boot.version>
<lettuce.version>6.3.2.RELEASE</lettuce.version>
<jedis.version>5.0.2</jedis.version> 我认为可以先让 2.8.0 同步到 3.2.0,在修订号迭代中再考虑升级 3.2.x 的小版本 我在尝试升级的时候发现当前版本的 redisson 引入了一个低版本的 Spring: https://github.com/redisson/redisson/blob/redisson-3.18.0/redisson-spring-boot-starter/pom.xml 那么要同步所有版本都到 3.2.0,将 redisson 也升级到 3.25.0 才行:https://github.com/redisson/redisson/blob/redisson-3.25.0/redisson-spring-boot-starter/pom.xml |
@areyouok 我发起了两个 PR,一个是为 2.7.x,另一个则是为 2.8.x 提供的 JedisCluster Pipeline 支持,你可以看下吗?
2.8.x 那版更新了很多依赖,但是单测看起来只有 Redisson 有不兼容 Kryo 序列化问题,我用配置重写降级了默认的 KryoCodec,其余的兼容性我还没验证,如果单测能够 cover 住,那应该没问题。 2.7.x 的那版考虑近期发一个版本吗?谢谢 |
我很长时间没有改过这个项目了。很多东西包括jedis新旧版本的差异我也不记得了,我需要一些时间来评估。也许不需要改那么多。 |
我看了一下4.3.2的代码,ClusterPipeline是个重量级对象,每次new一个应该是不行的,应该取UnifiedJedis类的provider字段,对于JedisCluster实例来说,就是ClusterConnectionProvider,做个类型转换就好了。 provider字段是protected,也没有getter,我认为最简单的修改方式是在构造RedisCache类的时候,通过反射拿出来。这样只需要改一个类。没有特别的需要,也不用升级jedis/spring的版本了,jetcache2.7搭配高版本spring/jedis应该也可以运行的。 通过wrapper的方式继承,就还有更多的地方要改,因为Cache可以通过API来构造(构造的时候需要传入JedisClusterWrapper),RedisAutoConfiguration不是唯一入口。 |
closed by #866 |
GET_ALL还需要优化吗? |
可以,不过 GET_ALL 只能优化集群那边的处理逻辑,非集群下反而 mget 和 del(keys) 性能好点,我尝试提个 PR 看看 |
我的意思就是cluster情况下的GET_ALL |
在 #873 把 GET_ALL 和 REMOVE_ALL 都改了 |
Motivation
目前的 JedisCluster 模式下,PUT_ALL 是单线程遍历执行的,考虑到 Jedis 已经在 4.0 支持上了 ClusterPipeline,JetCache 有考虑支持吗?
Jedis 相关 ISSUE、PR:
升级到 5.x 版本,API 会流畅一点,但是 4.4.0 也够用,我提个 PR 看看?
The text was updated successfully, but these errors were encountered: