Kitex Release v0.5.0

Introduction to Key Changes

Feature

1. Fallback: Support fallback for client-side

When the RPC requests fail, users usually have some degradation measures to ensure the effective response (for example, construct the default response after the request timeout or circuit breaker). Kitex’s Fallback supports the processing of all error requests. At the same time, because business errors are usually returned through the Resp (BaseResp field), Kitex also supports the processing of Resp. Refer to Fallback.

2. Kitex - gRPC: Client add TLS option configuration

Setup via client.WithGRPCTLSConfig option.

3. Kitex - Tool

Optimization

1. Loadbalance:Use Weighted Round Robin algo as default Loadbalance policy

The old version uses Weight Random to do the loadbalance by default. Random can achieve the global balance. However, in the case of a small number of server instances, there is a large probability of random continuous access to the same instance, resulting in an increase in the maximum concurrent requests of downstream nodes. Therefore, the new version adjusts the default policy to Weight Round Robin. Refer to Loadbalance

2. Goroutine Resource of Connection Pool

When the old version uses a long connection, each client corresponds to a goroutine resource cleaning connection. When there are many clients, it will cause too many goroutines. The new version changes to share the goroutine to avoid the number of goroutines increasing with the number of clients.

Other

Upgrade the frugal and pid dependency lib to support go 1.20.


Full Release Log

Feature

  • [#840] feat(fallback): support fallback ability for kitex client-side, usage guide refer to Fallback
  • [#841] feat(tool): add GetResult() and GetFirstArgument() methods for service params of protobuf
  • [#791] feat(tool): merge two ways of passing extensions, to support two ways at sametime
  • [#797] feat(loadbalance): use smooth weighted round robin algo as default Loadbalance policy
  • [#760] feat(grpc): support TLS config in kitex grpc client
  • [#781] feat(tool): supports custom templates
  • [#783] feat(ttheader): add encode logic for gdpr token in TransInfo
  • [#775] feat(tool): support custom generate path
  • [#687] feat(tool): add protoc plugin flag

Optimize

  • [#750] optimize(generic): generic call write zero value for required and default fields to meet the specification of apache thrift and keep consistent with normal thrift encode of Kitex.
  • [#739] optimize(generic): modify the url routing to align with Hertz for HTTP generic call
  • [#752] optimize(ttheader): attach part of ttheader binary into error when readKVInfo failed, which is useful for troubleshooting
  • [#821] optimize(config): add DeepCopy() & Equals() to circuitbreaker.CBConfig and retry.Policy
  • [#827] optimize: revise the remoteInfo of retry call, using the remoteInfo of the RPCCall that returns
  • [#762] optimize(tool): add go mod auto replace to thrift 0.13 in thrift mode
  • [#755] optimize: improve client error msg when ctx cancel or timeout
  • [#756] optimize: use sync.Cond as the profiler event trigger
  • [#753] optimize: add recover for client’s Close

Fix

  • [#734] fix(retry): fix the panic problem caused by concurrent read and write of rpcinfo under backup retry
  • [#837 #842] fix(metahandler): adjust MetainfoHandler to the top of the MetaHandlers array to ensure that the logic of custom MetaHandlers that depends on MetainfoHandler works
  • [#812] fix: use detectionHandler to perform protocol detection in windows environment to support gRPC
  • [#851] fix: upgrade frugal to v0.1.6 for missing stop field
  • [#845] fix: fix the problem that RPCStat report status as success when biz handler return err
  • [#822] fix(loadbalance): don’t share balancer factory when loadbalance is defined by user
  • [#732] fix(mux): mux server waits for shardqueue close before shutdown
  • [#795] fix(grpc): zero first byte of grpc data frame, which could be random data from mcache
  • [#668] fix: fix race problem in queue.go/queue @dugenkui03
  • [#743] fix: use sharedTicker for long conn pool to prevent goroutine numbers increase as the number of client increases
  • [#799] fix(util): should return when get at least one GOPATH @StellarisW
  • [#807] fix(codec): fix fastpb nil ptr when struct fields are all default values
  • [#794] fix(tool): fix fastpb codegen by updating dependency
  • [#787] fix(tool): the import did not use the new method to render when template append content
  • [#785] fix(tool): remove useless combine service files
  • [#754] fix: fix the usage of metainfo in grpc scene

Refactor

  • [#814 #843] refactor(trans): return error in onRead of defaultServerHandler and close conn in outer method
  • [#816] refactor(utils): add utils.GetEnvLogDir and deprecate utils.GetLogDir

Test & Docs & Chore

  • [#839 #693] test: import mockey repo and add usage demo of mockey unit test
  • [#806] test(transmeta):add some test cases for tansmeta package
  • [#761] docs: update README.md @fuergaosi233
  • [#817, #832] chore: upgrade dependency lib to adapt go 1.20
  • [#772] chore: modify kitex gen code meta file name from kitex.yaml to kitex_info.yaml