Closed Layfolk-zcy closed 1 year ago
Postman doesnt need load balancing. If your call is like this Postman -RestApi-> Server -grpc-> ServerN
and you want the load balancing to happen between the servers. One important thing to check is whether Server
actually knows both ServerN
s. You can debug that in https://github.com/yidongnan/grpc-spring-boot-starter/blob/ec610d22753dd38227c39f4d8c3ec251227e3cd7/grpc-client-spring-boot-autoconfigure/src/main/java/net/devh/boot/grpc/client/nameresolver/DiscoveryClientNameResolver.java#L309
If you have only one server there then there is an issue with the nacos registration. If two are there then this is a grpc-java behavioral question that is easier to directly ask there/upstream. Also try to execute more requests in parallel, otherwise it might try to safe connections.
result is constant.
Not sure why you added this comment. I dont expect it to differ unless you changed the implementation of one of the servers.
Does that help you?
Postman doesnt need load balancing. If your call is like this
Postman -RestApi-> Server -grpc-> ServerN
and you want the load balancing to happen between the servers. One important thing to check is whetherServer
actually knows bothServerN
s. You can debug that inIf you have only one server there then there is an issue with the nacos registration. If two are there then this is a grpc-java behavioral question that is easier to directly ask there/upstream. Also try to execute more requests in parallel, otherwise it might try to safe connections.
result is constant.
Not sure why you added this comment. I dont expect it to differ unless you changed the implementation of one of the servers.
Does that help you?
I thought the @GrpcClient annotation would enable a custom implementation load on service instances in the nacos registry, so I sent a request through postman for a simple case test, but the request results were consistent so I raised the issue
At this time, in the example project in the source code, I directly copied a cloud-grpc-server, only modified the port number of the service, and started the two servers to register with nacos at the same time, and called the restful interface of the client through postman
The @GrpcClient
ist basically just a @Autowired
annotation with some additional configuration from grpc.client properties for stubs and channels.
All grpc connection/load-balancing logic is provided by grpc-java and we just provide options to configure and inject them. (The DiscoveryClient lookup is also provided by this library, but it is just a lookup like DNS, the actual connection is created and handled by grpc-java)
The postman call does not implement load balancing.The servers of both GRPCS start before the clients
result is constant.