wwbmmm commented on issue #2142: URL: https://github.com/apache/brpc/issues/2142#issuecomment-1452935390
> 计算节点的时候,通过请求带的 request_code 来(request_code 应该由 RedisClusterRequest 自动计算填充,通过 CRC32/16384 计算)。 目前RedisRequest支持批量,但是多个批量请求的key可能hash到不同的server,而当前一次RPC过程会把请求都发到同一个server,所以可能要加个限制,一次RPC的多个批量请求的key必须相同,否则实现起来会很复杂 > 增加一个 Controller 逻辑,当客户端发现 redis cluster 返回 MOVED 之后,立即触发一次 RedisClusterNamingService 同步更新。同时修改 PreHashLoadBalancer 的路由表 目前Controller能拿到LB,但是拿不到NamingService对象。Controller耦合NamingService似乎不是一个好主意,可以考虑只更新LB就可以。 > 增加 Controller 逻辑,当客户端发现 redis cluster 返回 ASK 之后,直接修改请求地址,并在请求之前增加一个 ASKING 指令并获得其返回值(ASKING 在每个 SLOT 变化的时候都需要重新发送至少一次),再重新 IssueRPC,做重定向。 这里需要一定的抽象,可以抽象一个通用的Controller Redirect流程 > 是否需要自定义 Controller 来处理和控制 Redis Cluster 请求的 MOVE 和 ASK 继承Controller父类,来实现Redis Cluster请求流程,这也是一个思路,但需要考虑Controller父类需要留出哪些接口给子类实现。毕竟Controller里的逻辑很复杂,不可能让子类完全重写一遍。 > 是否需要重新注册一个 Redis Cluster protocol 协议。因为从协议上来看,redis cluster protocol 和 redis 都用的 RESP2 协议。 看起来好像没必要?在协议解析这方面,并没有什么区别。 > 是否需要单独独立一个 RedisClusterRequest ,还是在 RedisRequest 上加个字段来区分是否使用的 cluster 模式? 如果实现了自定义的RedisController,也可以放在那里做一些cluster特有逻辑,就不用在Request上做区分 > 如果要计算 request_code 需要 aware 用户请求,那么需要修改 RedisRequest 的解析段。是否让用户主动传入,我们不做计算?(感觉这里如果放开了会是个暗坑)。 最好不要让用户传入 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
