refactor(triple): upgrade triple client to service-level abstraction#3086
Conversation
|
issue #3087 |
|
please fix the code format |
|
Maybe it would be better to put TriClientPool in a separate new file instead of cramming it into the existing client.go? |
|
This PR is still in progress. I’ll update it once it's ready for review. |
1fd05cc to
5caf993
Compare
|
Fix ci error. |
5caf993 to
0588f18
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #3086 +/- ##
===========================================
+ Coverage 46.76% 48.04% +1.27%
===========================================
Files 295 460 +165
Lines 17172 33145 +15973
===========================================
+ Hits 8031 15924 +7893
- Misses 8287 15926 +7639
- Partials 854 1295 +441 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
0aa8efa to
f99ee04
Compare
|
@marsevilspirit review |
f5b2a76 to
f3f503e
Compare
|
@marsevilspirit done |
|
Write a performance test to demonstrate that your change can improve the throughput of triple. |
nanjiek
left a comment
There was a problem hiding this comment.
Why delete the error message about base and interface?
|
Thanks for reviewing. I will fix later |
f3f503e to
78dba57
Compare
Alanxtl
left a comment
There was a problem hiding this comment.
protocol/triple/client_pool.go needs sound unit tests, please write a test file for it
78dba57 to
e908b8a
Compare
b2d8371 to
8251f35
Compare
8251f35 to
01443d1
Compare
|
benchmark 能不能加 大流量 和 并发量高一些 的场景,看一下这两种场景中修改前后的benchmark结果 |
|
Performance test reference: https://github.com/marsevilspirit/dubbo-go-benchmark |
ok |
got it |
|
Is this PR process still ongoing? |
e40c041 to
009eb10
Compare
|
This PR originally implemented a TriClientPool, but the design was refactored to a service-level client. |
|
@Aetherance please fix the file confliction |
009eb10 to
9b1537d
Compare
|
@AlexStocks confliction fixed |
- Change triple_protocol.Client from procedure-level to service-level - Simplify clientManager from map[string]*Client to single *Client - Unify IDL and non-IDL client creation logic - Fix connect-go interoperability by updating ping.connect.go Reduces client instances from O(methods) to O(1) per service. Net: -16 lines of code. Signed-off-by: Aetherance <inkToAether@gmail.com>
9b1537d to
0762edb
Compare
Add handling for empty strings and multiple slashes in normalizeClientProcedure.
|



Background
Currently,
triple_protocol.Clientis designed as a procedure-level client (one client instance per RPC method), which leads to:clientManagermaintains amap[string]*Clientto track method-level clientsThis design differs from the gRPC client model, which uses a service-level client, where a single client instance manages all RPC methods of a service.
Changes
This PR refactors
triple_protocol.Clientto a service-level architecture.protocol/triple/triple_protocol/client.go)Add
method stringparameter to allCall*methods:CallUnary(ctx, req, res, method)CallClientStream(ctx, method)CallServerStream(ctx, req, method)CallBidiStream(ctx, method)Introduce
buildMethodLevelReqSpec()to construct method-level request specs from a service-level specAdd
normalizeClientProcedure()for consistent URL path handlingprotocol/triple/client.go)Refactor
clientManagerfrom a method-level to a service-level structure:getClient(method)helpermethodparameterprotocol/triple/triple_protocol/duplex_http_call.go)url.Path = spec.Procedureto ensure requests are routed to the correct RPC methodImpact
Memory & Performance
API Compatibility
triple_protocol.ClientAPIs now require an explicitmethodparametertriple_protocolis primarily an internal APIclient.Clientandclient.Connectionremain compatibleMigration Guide
For direct users of
triple_protocol.Client(rare):