項目:Kitex
https://github.com/cloudwego/kitex
建議直接升級 Kitex 版本到 v0.13.1,因為我們對 v0.13.0 裏 gRPC Client 潛在的 Goroutine 泄漏問題進行了修復
重要變更介紹
> 新特性
1. 新流式接口 StreamX 支持 gRPC,存量 Kitex gRPC 用户可遷移
v0.12.0 發佈了 StreamX 接口優化流式體驗,支持了自定義流式協議 TTHeader Streaming,但未支持 gRPC,導致存量用户無法遷移。
v0.13.0 對 StreamX 支持 gRPC 後,用户可遷移至 StreamX 新接口,Server 端可以同時兼容兩個流式協議,無需擔心接口遷移後的協議兼容性問題。
特別地,StreamX 在適配 gRPC 時,發現依然有一些不便利的問題,為帶來更好的接口使用體驗,因此對 StreamX 接口做了二次調整。
已經使用 v0.12.* 的 StreamX 用户會帶來影響,在這裏表示抱歉。
詳見 StreamX 用户文檔(https://www.cloudwego.io/zh/docs/kitex/tutorials/basic-featur...)。
2. Prutal - Protobuf 的無生成代碼序列化庫
Prutal (https://github.com/cloudwego/prutal)正式開源,對標 Thrift 的 Frugal (https://github.com/cloudwego/frugal)庫,新版本 Kitex 默認集成 Prutal。特點:
詳細信息參考 Prutal(https://www.cloudwego.io/zh/docs/kitex/tutorials/code-gen/prutal)。
- 產物體積最小化,只需生成結構體
- 使用與 Frugal 相似的反射優化,性能優於官方 Protobuf
- 兼容官方 Protobuf 及衍生版本的生成代碼
> 功能/體驗優化
1. TTHeader Streaming 支持配置接口級別 Recv 超時
本版本 TTHeader Streaming 在原有的 Kitex Client 級別基礎上,額外支持接口級別的 Recv 超時配置,配置更為靈活。
詳見 StreamX 流超時控制(https://www.cloudwego.io/zh/docs/kitex/tutorials/basic-featur...)。
2. Thrift 默認傳輸協議由 Buffered 改為 Framed
這個變更可以利用 FastCodec 以獲得更高的編解碼性能。
> 其他
- 產物簡化
- 若想恢復這部分代碼,生成命令追加
-thrift no_default_serdes=false - 若只想恢復 DeepEqual,生成命令追加
-thrift gen_deep_equal=true - 若想恢復 Set 的重複校驗,生成命令追加
-thrift validate_set=true, -thrift gen_deep_equal=true - 默認不生成 Set 數據結構的重複校驗代碼與各結構體的 DeepEqual 函數
-
默認不生成 Apache Codec 相關代碼
- Go 支持版本變化
- 支持版本 Go 1.19~1.24,最低支持版本變為 Go 1.19,如果 Go 版本過低,編譯時會有提示:
note: module requires Go 1.19
詳細變更
Feature
[#1719] feat: prutal for replacing protoc
[#1736] feat(ttstream): support WithRecvTimeout stream call option
[#1702] feat(gRPC): add grpc client conn dump to help debug the conn and stream status
[#1723] feat(codec/thrift): use fastcodec/frugal if apache codec not available
[#1724] feat: add tail option to support for delayed initialization of some client options
Optimize
[#1728] optimize(apache): remove apache codec gen and set default protocol from buffered to framed
[#1732] optimize(rpcinfo): purify the transport protocol of rpcinfo in a single rpc request
[#1711] optimize(tool): disable set validate and deep equal code gen to simplify kitex\_gen
[#1717] optimize(gRPC): return more detailed error when received invalid http2 frame
Fix
[#1734] fix(ttstream): adjust stream state transition and remove all SetFinalizer to avoid memory leak
[#1735] fix(generic): support both relative and absolute check for idl includes parse to make it compatible with generation tool
[#1725] fix: code gen import issue for streamx mode, stream call judgement bug and set ttheader streaming as default
[#1727] fix(tool): fix tool UseStdLib remains unexcepted lib issue.
Refactor
[#1658] refactor: streamx api to adapt both grpc and ttheader streaming protocol and provide more user-friendly interface
[#1729] refactor(tool): move pb tpl code to sep pkg
Chore
[#1743] chore: update dependencies version
[#1740] chore(generic): deprecate NewThriftContentProvider
[#1741] chore(streamx): remove redundant streamx package
[#1738] ci: fix typos & crate-ci/typos
[#1737] chore: update dependency and change go support to 1.19-1.24
[#1720] Revert “fix(ttstream): pingpong method refers to server interface defined in Kitex generation code when streamx is enabled and there are other streaming methods”
相關鏈接
項目地址:
https://github.com/cloudwego/kitex
項目官網:https://www.cloudwego.io