Re: [grpc-io] grpc connections and threadpool question

2021-05-13 Thread 'Sanjay Pujare' via grpc.io
I'll let someone from the gRPC C++ side answer your questions.

On Thu, May 13, 2021 at 9:08 PM Jeff Steger  wrote:

>
> Hi Sanjay,
>
> I am using C++. Does this help you to clarify your below statements?
>
> Jeff
>
>
> On Thu, May 13, 2021 at 7:42 PM 'Sanjay Pujare' via grpc.io <
> grpc-io@googlegroups.com> wrote:
>
>> Comments/questions below:
>>
>> On Thu, May 13, 2021 at 4:12 PM Jeff Steger  wrote:
>>
>>> Hi all,
>>>
>>> I have a quick question about grpc connections. I am running a grpc
>>> synchronous server that mostly replies to single (not streaming) requests
>>> with single (not streaming) replies.
>>>
>>
>> Which language are you using?
>>
>> I understand that each new request is handled by a thread from the grpc
>>> framework’s threadpool. I notice that for even after the request is handled
>>> and a reply is sent and processed by the client, the tcp connection between
>>> the client and server is not taken down. How long does the connection
>>> persist?
>>>
>>
>> According to this doc
>> https://github.com/grpc/grpc/blob/master/doc/connectivity-semantics-and-api.md
>>
>>
>> "When there has been no RPC activity on a channel for a specified
>> IDLE_TIMEOUT, i.e., no new or pending (active) RPCs for this period,
>> channels that are READY or CONNECTING switch to IDLE.  We will use a
>> default IDLE_TIMEOUT of 300 seconds (5 minutes)."
>>
>> Is it in anyway coupled to the lifetime of the thread in the threadpool?
>>>
>>
>> The thread lifetime and connection lifetime should be unrelated.
>>
>> When does the threadpool reclaim the thread that was used to process the
>>> request? Thanks for your help!
>>>
>>
>> Depends on the gRPC language you are using.
>>
>>
>>>
>>> Jeff
>>>
>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "grpc.io" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to grpc-io+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/grpc-io/CAA-WHu%3DfP%2BFTT5PHXMF7sE3QakXvD5VaHqEf2WYdjm2zWtz95g%40mail.gmail.com
>>> 
>>> .
>>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "grpc.io" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to grpc-io+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/grpc-io/CA%2BPad6hdJfvHP3xb5tLOSotSC4JqKzxiCYYjepx8Gq%3DWprJWVQ%40mail.gmail.com
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CA%2BPad6j_8eeX5eX6p6DtXBG3pNH1__ji_zCFW_PyNZUFCrNp8A%40mail.gmail.com.


Re: [grpc-io] Unable to get gRPC DNS resolver to return multiple IP addresses

2021-05-13 Thread 'Gaurav Poothia' via grpc.io
Not sure why this worked when I changed the hostname from "localhost" to
something custom.
Nevermind I think I am unblocked now.

thanks!

On Thu, May 13, 2021 at 5:09 PM 'Gaurav Poothia' via grpc.io <
grpc-io@googlegroups.com> wrote:

> Hello,
> I am prototyping gRPC client side round robin load balancing.
> So if client wants to dial to "localhost" I want it to load balance
> requests round robin over different loopback addresses e.g. 127.0.0.1,
> 127.0.0.2, 127.0.03 etc
>
> For this experiment I configured unbound (by local DSN) to appropriately
> return multiple A records for "localhost" like so:
>
> $ dig localhost
>
> ; <<>> DiG 9.16.1-Ubuntu <<>> localhost
>
> ;; global options: +cmd
>
> ;; Got answer:
>
> ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7826
>
> ;; flags: qr aa rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
>
>
> ;; OPT PSEUDOSECTION:
>
> ; EDNS: version: 0, flags:; udp: 4096
>
> ;; QUESTION SECTION:
>
> ;localhost. IN  A
>
>
> ;; ANSWER SECTION:
>
> localhost.  10800   IN  A   127.0.0.1
>
> localhost.  3600IN  A   127.0.0.3
>
> localhost.  3600IN  A   127.0.0.2
>
> ;; Query time: 0 msec
>
> ;; SERVER: 127.0.0.1#53(127.0.0.1)
>
> ;; WHEN: Thu May 13 23:51:33 UTC 2021
>
> ;; MSG SIZE  rcvd: 86
>
>
> I modified the hello world client in the grpc quick start guide to use
> round robin LB and
>
> const (
>
>   address = "dns:///localhost:50051"
>
>   defaultName = "world"
>
> )
>
> func main() {
>
>   resolver.SetDefaultScheme("dns")
>
>   // Set up a connection to the server.
>
>   conn, err := grpc.Dial(address, grpc.WithInsecure(),
> *grpc.WithBalancerName(roundrobin.Name*))
>
>   if err != nil {
>
> log.Fatalf("did not connect: %v", err)
>
>   }
>
>   defer conn.Close()
>
>   c := pb.NewGreeterClient(conn)
>
> When I run this  I notice that the DNS resolver is returning only 1 IP
> address instead  3 IPs hence there is nothing to load balance
>
> INFO: 2021/05/14 00:04:01 [core] parsed scheme: "dns"
>
> INFO: 2021/05/14 00:04:01 [core] ccResolverWrapper: sending update to cc:
> {[{127.0.0.2:50051   0 }]  }
>
> *INFO: 2021/05/14 00:04:01 [balancer] base.baseBalancer: got new
> ClientConn state:  {{[{127.0.0.2:50051    0
> }]  } }*
>
> INFO: 2021/05/14 00:04:01 [core] Subchannel Connectivity change to
> CONNECTING
>
> INFO: 2021/05/14 00:04:01 [balancer] base.baseBalancer: handle SubConn
> state change: 0xc000119d10, CONNECTING
>
> INFO: 2021/05/14 00:04:01 [core] Subchannel picks a new address "
> 127.0.0.2:50051" to connect
>
> INFO: 2021/05/14 00:04:01 [core] Channel Connectivity change to CONNECTING
>
> INFO: 2021/05/14 00:04:01 [core] Subchannel Connectivity change to READY
>
> INFO: 2021/05/14 00:04:01 [balancer] base.baseBalancer: handle SubConn
> state change: 0xc000119d10, READY
>
> INFO: 2021/05/14 00:04:01 [roundrobin] roundrobinPicker: newPicker called
> with info: {map[0xc000119d10:{{127.0.0.2:50051   0 }}]}
>
> INFO: 2021/05/14 00:04:01 [core] Channel Connectivity change to READY
>
>
> Any pointers on why dig(or nslookup) and the gRPC DNS resolver would
> return different number of IPs for the same name?
>
>
> Thanks in advance!
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "grpc.io" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/grpc-io/jwvUuO0Ltjs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> grpc-io+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/grpc-io/f9a7af26-522c-47dc-87e3-c05482f65c7fn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAFJ0%2B99Vgu39cubjZqZdb22e655d-cGWe9Bm4yZyYV_AABNbJg%40mail.gmail.com.


Re: [grpc-io] grpc connections and threadpool question

2021-05-13 Thread Jeff Steger
Hi Sanjay,

I am using C++. Does this help you to clarify your below statements?

Jeff


On Thu, May 13, 2021 at 7:42 PM 'Sanjay Pujare' via grpc.io <
grpc-io@googlegroups.com> wrote:

> Comments/questions below:
>
> On Thu, May 13, 2021 at 4:12 PM Jeff Steger  wrote:
>
>> Hi all,
>>
>> I have a quick question about grpc connections. I am running a grpc
>> synchronous server that mostly replies to single (not streaming) requests
>> with single (not streaming) replies.
>>
>
> Which language are you using?
>
> I understand that each new request is handled by a thread from the grpc
>> framework’s threadpool. I notice that for even after the request is handled
>> and a reply is sent and processed by the client, the tcp connection between
>> the client and server is not taken down. How long does the connection
>> persist?
>>
>
> According to this doc
> https://github.com/grpc/grpc/blob/master/doc/connectivity-semantics-and-api.md
>
>
> "When there has been no RPC activity on a channel for a specified
> IDLE_TIMEOUT, i.e., no new or pending (active) RPCs for this period,
> channels that are READY or CONNECTING switch to IDLE.  We will use a
> default IDLE_TIMEOUT of 300 seconds (5 minutes)."
>
> Is it in anyway coupled to the lifetime of the thread in the threadpool?
>>
>
> The thread lifetime and connection lifetime should be unrelated.
>
> When does the threadpool reclaim the thread that was used to process the
>> request? Thanks for your help!
>>
>
> Depends on the gRPC language you are using.
>
>
>>
>> Jeff
>>
> --
>> You received this message because you are subscribed to the Google Groups
>> "grpc.io" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to grpc-io+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/grpc-io/CAA-WHu%3DfP%2BFTT5PHXMF7sE3QakXvD5VaHqEf2WYdjm2zWtz95g%40mail.gmail.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups "
> grpc.io" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to grpc-io+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/grpc-io/CA%2BPad6hdJfvHP3xb5tLOSotSC4JqKzxiCYYjepx8Gq%3DWprJWVQ%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAA-WHu%3Di_kogkDcSx5Kfyh%3DeivTQKE-G6KafJrD4kkM7g4j9gQ%40mail.gmail.com.


[grpc-io] L79 gRFC: ClientAsyncResponseReaderInterface destruction

2021-05-13 Thread 'Aaron Jacobs' via grpc.io
This is the discussion thread for L79: ClientAsyncResponseReaderInterface
destruction:

https://github.com/grpc/proposal/pull/238/files

Please let me know if you have any concerns.

Aaron

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/846d2f51-b1f5-4041-8bab-3f862ecc1c6en%40googlegroups.com.


[grpc-io] Unable to get gRPC DNS resolver to return multiple IP addresses

2021-05-13 Thread 'Gaurav Poothia' via grpc.io
Hello,
I am prototyping gRPC client side round robin load balancing.
So if client wants to dial to "localhost" I want it to load balance 
requests round robin over different loopback addresses e.g. 127.0.0.1, 
127.0.0.2, 127.0.03 etc

For this experiment I configured unbound (by local DSN) to appropriately 
return multiple A records for "localhost" like so:

$ dig localhost

; <<>> DiG 9.16.1-Ubuntu <<>> localhost

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7826

;; flags: qr aa rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1


;; OPT PSEUDOSECTION:

; EDNS: version: 0, flags:; udp: 4096

;; QUESTION SECTION:

;localhost. IN  A


;; ANSWER SECTION:

localhost.  10800   IN  A   127.0.0.1

localhost.  3600IN  A   127.0.0.3

localhost.  3600IN  A   127.0.0.2

;; Query time: 0 msec

;; SERVER: 127.0.0.1#53(127.0.0.1)

;; WHEN: Thu May 13 23:51:33 UTC 2021

;; MSG SIZE  rcvd: 86


I modified the hello world client in the grpc quick start guide to use 
round robin LB and 

const (

  address = "dns:///localhost:50051"

  defaultName = "world"

)

func main() {

  resolver.SetDefaultScheme("dns")

  // Set up a connection to the server.

  conn, err := grpc.Dial(address, grpc.WithInsecure(), 
*grpc.WithBalancerName(roundrobin.Name*))

  if err != nil {

log.Fatalf("did not connect: %v", err)

  }

  defer conn.Close()

  c := pb.NewGreeterClient(conn)

When I run this  I notice that the DNS resolver is returning only 1 IP 
address instead  3 IPs hence there is nothing to load balance

INFO: 2021/05/14 00:04:01 [core] parsed scheme: "dns"

INFO: 2021/05/14 00:04:01 [core] ccResolverWrapper: sending update to cc: 
{[{127.0.0.2:50051   0 }]  }

*INFO: 2021/05/14 00:04:01 [balancer] base.baseBalancer: got new ClientConn 
state:  {{[{127.0.0.2:50051   0 }]  } }*

INFO: 2021/05/14 00:04:01 [core] Subchannel Connectivity change to 
CONNECTING

INFO: 2021/05/14 00:04:01 [balancer] base.baseBalancer: handle SubConn 
state change: 0xc000119d10, CONNECTING

INFO: 2021/05/14 00:04:01 [core] Subchannel picks a new address 
"127.0.0.2:50051" to connect

INFO: 2021/05/14 00:04:01 [core] Channel Connectivity change to CONNECTING

INFO: 2021/05/14 00:04:01 [core] Subchannel Connectivity change to READY

INFO: 2021/05/14 00:04:01 [balancer] base.baseBalancer: handle SubConn 
state change: 0xc000119d10, READY

INFO: 2021/05/14 00:04:01 [roundrobin] roundrobinPicker: newPicker called 
with info: {map[0xc000119d10:{{127.0.0.2:50051   0 }}]}

INFO: 2021/05/14 00:04:01 [core] Channel Connectivity change to READY


Any pointers on why dig(or nslookup) and the gRPC DNS resolver would return 
different number of IPs for the same name?


Thanks in advance!

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/f9a7af26-522c-47dc-87e3-c05482f65c7fn%40googlegroups.com.


Re: [grpc-io] grpc connections and threadpool question

2021-05-13 Thread 'Sanjay Pujare' via grpc.io
Comments/questions below:

On Thu, May 13, 2021 at 4:12 PM Jeff Steger  wrote:

> Hi all,
>
> I have a quick question about grpc connections. I am running a grpc
> synchronous server that mostly replies to single (not streaming) requests
> with single (not streaming) replies.
>

Which language are you using?

I understand that each new request is handled by a thread from the grpc
> framework’s threadpool. I notice that for even after the request is handled
> and a reply is sent and processed by the client, the tcp connection between
> the client and server is not taken down. How long does the connection
> persist?
>

According to this doc
https://github.com/grpc/grpc/blob/master/doc/connectivity-semantics-and-api.md


"When there has been no RPC activity on a channel for a specified
IDLE_TIMEOUT, i.e., no new or pending (active) RPCs for this period,
channels that are READY or CONNECTING switch to IDLE.  We will use a
default IDLE_TIMEOUT of 300 seconds (5 minutes)."

Is it in anyway coupled to the lifetime of the thread in the threadpool?
>

The thread lifetime and connection lifetime should be unrelated.

When does the threadpool reclaim the thread that was used to process the
> request? Thanks for your help!
>

Depends on the gRPC language you are using.


>
> Jeff
>
> --
> You received this message because you are subscribed to the Google Groups "
> grpc.io" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to grpc-io+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/grpc-io/CAA-WHu%3DfP%2BFTT5PHXMF7sE3QakXvD5VaHqEf2WYdjm2zWtz95g%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CA%2BPad6hdJfvHP3xb5tLOSotSC4JqKzxiCYYjepx8Gq%3DWprJWVQ%40mail.gmail.com.


[grpc-io] grpc connections and threadpool question

2021-05-13 Thread Jeff Steger
Hi all,

I have a quick question about grpc connections. I am running a grpc
synchronous server that mostly replies to single (not streaming) requests
with single (not streaming) replies. I understand that each new request is
handled by a thread from the grpc framework’s threadpool. I notice that for
even after the request is handled and a reply is sent and processed by the
client, the tcp connection between the client and server is not taken down.
How long does the connection persist? Is it in anyway coupled to the
lifetime of the thread in the threadpool? When does the threadpool reclaim
the thread that was used to process the request? Thanks for your help!

Jeff

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAA-WHu%3DfP%2BFTT5PHXMF7sE3QakXvD5VaHqEf2WYdjm2zWtz95g%40mail.gmail.com.


Re: [grpc-io] grpc calls on activemq

2021-05-13 Thread Amit Saha


> On 13 May 2021, at 10:16 pm, Karan Kaira  wrote:
> 
> 
> I am working with ActiveMQ(beginner). I want to put gRPC calls as a message 
> on ActiveMQ. As soon as consumer picks a message , the gRPC in the message 
> should execute.
> 
> gRPC calls take parameters , so I want to understand how to send these 
> parameters in the message body along with the method name/identifier , or if 
> there is any another way of achieving this which is followed already?
> 
> Example :
> 
> ```
> 
> someResponse response = someStub.rpcMethodName(parameter); // grpc call 
> ```
> What I need is to store this statement in some format on activemq without 
> calling the grpc now , then in the future when the consumer of activemq picks 
> up the message containing this statement it should execute this gRPC call.
> 
> 

If the key objective you are trying to achieve here is to defer the execution 
of the actual request itself, you may be able to do so by coming up with a way 
to handle an incoming gRPC call/request, persisting the data in the broker (may 
be a custom serialisation format? Or may be you could use JSON) and then having 
consumers consuming from that broker, which recognises the data format, and 
then makes the actual gRPC call.


> Thanks.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "grpc.io" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to grpc-io+unsubscr...@googlegroups.com 
> .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/grpc-io/dda22bd6-3f96-4a7e-80b6-24a069744f29n%40googlegroups.com
>  
> .

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/EC24E19E-5B60-4098-B149-095BE1E86A93%40gmail.com.


Re: [grpc-io] grpc calls on activemq

2021-05-13 Thread 'Sanjay Pujare' via grpc.io
Take a look at how gRPC is implemented over http2 at
https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md .

That will give you some idea of how you can "persist" the relevant parts of
an http2 request as an ActiveMQ message to be executed later as a gRPC
call.

On Thu, May 13, 2021 at 5:16 AM Karan Kaira 
wrote:

>
> I am working with ActiveMQ(beginner). I want to put gRPC calls as a
> message on ActiveMQ. As soon as consumer picks a message , the gRPC in the
> message should execute.
>
> gRPC calls take parameters , so I want to understand how to send these
> parameters in the message body along with the method name/identifier , or
> if there is any another way of achieving this which is followed already?
>
> Example :
>
> ```
> someResponse response = someStub.rpcMethodName(parameter); // grpc call
> ```
>
> What I need is to store this statement in some format on activemq without
> calling the grpc now , then in the future when the consumer of activemq
> picks up the message containing this statement it should execute this gRPC
> call.
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups "
> grpc.io" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to grpc-io+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/grpc-io/dda22bd6-3f96-4a7e-80b6-24a069744f29n%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CA%2BPad6hNd5PhzW_JxZsvOK4GJCa8YNLMTSXBAP0uVitcQHLwtQ%40mail.gmail.com.


[grpc-io] grpc calls on activemq

2021-05-13 Thread Karan Kaira


I am working with ActiveMQ(beginner). I want to put gRPC calls as a message 
on ActiveMQ. As soon as consumer picks a message , the gRPC in the message 
should execute.

gRPC calls take parameters , so I want to understand how to send these 
parameters in the message body along with the method name/identifier , or 
if there is any another way of achieving this which is followed already?

Example :

```
someResponse response = someStub.rpcMethodName(parameter); // grpc call 
```

What I need is to store this statement in some format on activemq without 
calling the grpc now , then in the future when the consumer of activemq 
picks up the message containing this statement it should execute this gRPC 
call.

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/dda22bd6-3f96-4a7e-80b6-24a069744f29n%40googlegroups.com.