grpc-consul-resolver icon indicating copy to clipboard operation
grpc-consul-resolver copied to clipboard

Doubt call grpc.Builder some wrong in many connections scenario

Open yushaolong10 opened this issue 4 years ago • 2 comments

Hey, I read the source code and find that already full implement for grpc.Resolver and adaptor the consul api, the functionality is ok. But i doubt this library maybe not work smoothly in production envirnments. According to the example in the document, one connection created is ok, But if i want to create many connections in my concurrency business scenarios like:

conn1, err := grpc.Dial(
        "consul://127.0.0.1:8500/whoami?wait=14s&tag=manual",
     )
....
conn2, err := grpc.Dial(
        "consul://127.0.0.1:8500/whoami?wait=14s&tag=manual",
     )

Above codes call two times grpc.Builder inter which be implemented in your code. This will lead twice call of under codes:

	go watchConsulService(ctx, cli.Health(), tgt, pipe)
	go populateEndpoints(ctx, cc, pipe)

Is this suitable or some logics that i am misunderstanding ? And how to use this libarary in correct way ?

yushaolong10 avatar Jun 17 '21 05:06 yushaolong10

i check the code again and find reason. It's my fault.

yushaolong10 avatar Jun 17 '21 05:06 yushaolong10

I am in a mess that i could not find whether grpc support pessistent connection and how to config it like some params MaxIdleConns in Golang.
I want to use grpc-conn-pool(https://github.com/shimingyah/pool) in grpc client to keep connections persistent, but it seems conflict with grpc-consul-resolver. Is there any suggestions for that? thanks.

yushaolong10 avatar Jun 17 '21 07:06 yushaolong10

Out dated. Please consider to update to latest version. If question stay let me know. Thanks.

mbobakov avatar Mar 29 '23 18:03 mbobakov