incubator-seata icon indicating copy to clipboard operation
incubator-seata copied to clipboard

Feature: Refactor Raft watch API to support HTTP/2

Open funky-eyes opened this issue 6 months ago • 5 comments

Why you need it?

当前raft的元数据更新通知,通过http1的longpolling方式感知变化。而目前Seata Server已经支持http2协议,理论上稍加改造便可以支持http2方式,并且相对于longpolling方式而言,实时性更高。 需求:

  1. 保留原本http1方式的watch接口
  2. 增加新的http2方式的watch接口
  3. client通过识别server版本号,决定使用http1或http2从而保证多版本兼容。 你可以提交多个pr来逐步完成这个特性。

Currently, Raft metadata update notifications rely on the long polling mechanism over HTTP/1 to detect changes. However, Seata Server now supports the HTTP/2 protocol, which, with some modifications, could enable support for HTTP/2-based notifications. Compared to long polling, HTTP/2 could provide better real-time performance.

Requirements:

  1. Retain the original watch interface based on HTTP/1.
  2. Add a new watch interface that supports HTTP/2.
  3. Clients should determine whether to use HTTP/1 or HTTP/2 for the watch interface based on the server version, ensuring compatibility across different versions.

You can submit multiple PRs to gradually implement this feature.

https://github.com/apache/incubator-seata/blob/2.x/server/src/main/java/org/apache/seata/server/controller/ClusterController.java

https://github.com/apache/incubator-seata/blob/2.x/discovery/seata-discovery-raft/src/main/java/org/apache/seata/discovery/registry/raft/RaftRegistryServiceImpl.java

How it could be?

No response

Other related information

No response

funky-eyes avatar Jun 04 '25 02:06 funky-eyes

May I take on this task? It might take a bit of time due to other issues, but I believe I can handle it :)

YongGoose avatar Jun 04 '25 02:06 YongGoose

May I take on this task? It might take a bit of time due to other issues, but I believe I can handle it :)

OK, no problem. Since we already have the long polling method in place, this task is not urgent.

funky-eyes avatar Jun 04 '25 02:06 funky-eyes

@funky-eyes

If there are any additional tasks that need to be done, please feel free to create sub-issues as needed.

YongGoose avatar Jul 16 '25 15:07 YongGoose

Also, I’d appreciate it if you could take a look at the PR. (#7492) I’ve been quite busy lately, so the progress has been a bit slow. I’ll make sure to allocate more time for the next tasks. 🚀

YongGoose avatar Jul 16 '25 15:07 YongGoose

@YongGoose in this pr #7492 I have a question to ask. When introducing okhttp dependencies to support http2, why wasn't the level set to provide? Otherwise, doing dependency detection would be meaningless . Is there any special logic ?

<dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>okhttp</artifactId>
        </dependency>

YvCeung avatar Sep 24 '25 02:09 YvCeung