lizining1231 commented on PR #3706:
URL: https://github.com/apache/dubbo-go/pull/3706#issuecomment-5442004580
> Dubbo Java 怎么可能不支持triple呢
dubbo-java 支持 triple,兼容性问题不在协议,在content-type,triple 在 dubbo-go 里有两种 wire
编码,分别是gRPC 编码Content-Type application/grpc+proto和connect 编码Content-Type
application/proto,dubbo-java 支持 是 gRPC 编码的 triple。
之前出于改动范围集中于“只优化triple协议的性能”,只优化triple协议,绕开grpc协议,不让fastpath的开关挂在grpc协议上而是挂在另一个路径connect,被迫应用connect编码,从而引发兼容性问题;如果把优化开关挂在grpc编码上,可以解决这个问题,应用grpc编码可以避免兼容性问题,不过这个行为同时会带来grpc协议路径也得到优化。
一些代码示例,如果使用grpc编码,就需要把开关放在`protocol_grpc.go`,自然有grpc性能收益:
`protocol_grpc.go`
```go
var call unaryClientCall
if spec.StreamType == StreamTypeUnary && g.UnaryFastPath {
call = newUnaryFastPathCall(
ctx,
g.HTTPClient,
g.URL,
spec,
header,
g.BufferPool,
)
} else {
call = newDuplexHTTPCall(
ctx,
g.HTTPClient,
g.URL,
spec,
header,
)
}
conn := &grpcClientConn{ ... }
```
原因是wire与协议的设置是绑定的,绕开grpc协议就会绕开grpc编码,这个文件就是 gRPC 编码的唯一实现,grpcClient.NewConn
是 gRPC 编码请求的唯一入口,所以应用grpc编码即是应用grpc协议
这个改动就是我之前提出的“优化grpc协议下的triple-unary路径”改动,把开关挂在grpc编码上,然后无论用户设置的是triple协议还是grpc协议,都得到优化,并且保证兼容性
--
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]