grpc-ecosystem / grpc-spring

Spring Boot starter module for gRPC framework.
https://grpc-ecosystem.github.io/grpc-spring/
Apache License 2.0
3.48k stars 816 forks source link

loadblance bug? #854

Closed saiyujs closed 1 year ago

saiyujs commented 1 year ago

version: grpc-client-spring-boot-starter-2.13.1.RELEASE

i do the test. i have one client program, two server program(server program--same serverName, different ip)

two ways to create channel:

Channel channel = ManagedChannelBuilder.forTarget("discovery:///" + serverName).defaultLoadBalancingPolicy("round_robin").usePlaintext().build();
Channel channel = ManagedChannelBuilder.forTarget("static://hostA:port,hostB:port").defaultLoadBalancingPolicy("round_robin").usePlaintext().build();

i send 10 request from client to server. first test 10 request loadblance fail, all request on hostA,but after first test, then second test, third test.......request loadblance success the test result by two ways of create channel are same. this is a bug?

ST-DDT commented 1 year ago

I dont understand your test setup/question. What is the expected result from the discovery-service. Is it the same as the other server?

Please also post your error logs.

saiyujs commented 1 year ago

image

grpc-client image image

when grpc-server receive request will print log.

my expected result : if send 10 request, hostA grpc-server receive 5 request(print 5 log), hostB grpc-server receive 5 request(print 5 log) actuality result: first time to wget /test, hostA grpc-server receive 10 request(10 log), hostB grpc-server receive 0 request(0 log) second time to wget /test, hostA grpc-server receive 5 request(5 log), hostB grpc-server receive 5 request(5 log)

first time loadblance fail

saiyujs commented 1 year ago

my test result: when first time request finished, await 10 sec, loadblance will be working image

ST-DDT commented 1 year ago

first time loadblance fail

Please show me the error log.

saiyujs commented 1 year ago

no error log.....

ST-DDT commented 1 year ago

So only the load balancing part fails, getting hostA 100% of the requests?

Does this happen regardless of whether you are using dns, static, discovery schemes?

saiyujs commented 1 year ago

yes,I just used static and discovery to test。 It feels like the host address synchronization was incomplete at the beginning。so only the load balancing part fails

ST-DDT commented 1 year ago

Please also test the dns one. If it is also affected please ask grpc-java directly for help as that is outside of my knowledge. (And please paste a link to the new issue here)

saiyujs commented 1 year ago

https://github.com/grpc/grpc-java/issues/9936#issuecomment-1457404647

saiyujs commented 1 year ago

thank you very much!!!

ST-DDT commented 1 year ago

You are welcome. Thanks for sharing the link, so I can also learn ❤️.