Re: [grpc-io] [iOS] SSL Mutual TLS

2018-08-06 Thread 'Muxi Yan' via grpc.io
Hi Rob,

I am not familiar with the c# API. CC'ing jtattermusch@ who can definitely
help.

On Mon, Aug 6, 2018 at 6:10 PM Rob Cecil  wrote:

> Muxi, how would a c# server specify mutual TLS ?
>
> Thanks
>
> On Mon, Aug 6, 2018 at 8:43 PM Muxi Yan  wrote:
>
>> Requirement of mutual TLS is from server's configurations. If it is
>> required by the server, the client can configure it with this function
>> 
>> .
>>
>> On Mon, Aug 6, 2018 at 5:24 PM Rob Cecil  wrote:
>>
>>> The online Grpc guide for authorization:
>>>
>>> https://grpc.io/docs/guides/auth.html
>>>
>>> Speaks about SSL/TLS:
>>>
>>>
>>>- *SSL/TLS*: gRPC has SSL/TLS integration and promotes the use of
>>>SSL/TLS to authenticate the server, and to encrypt all the data exchanged
>>>between the client and the server. Optional mechanisms are available
>>>for clients to provide certificates for mutual authentication.
>>>
>>> Can someone elaborate when Mutual TLS is required in Grpc for iOS and
>>> how to configure it ?
>>>
>>> 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 post to this group, send email to grpc-io@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/grpc-io.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/grpc-io/e3fffd57-bbd0-4767-b114-4f4307ad9736%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
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 post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAFD07aQPwBL9KdNVPHEZ%2BCtjSZT-bBBbxt-yrTZvFrvCWVykxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [grpc-io] [iOS] SSL Mutual TLS

2018-08-06 Thread Rob Cecil
Muxi, how would a c# server specify mutual TLS ?

Thanks

On Mon, Aug 6, 2018 at 8:43 PM Muxi Yan  wrote:

> Requirement of mutual TLS is from server's configurations. If it is
> required by the server, the client can configure it with this function
> 
> .
>
> On Mon, Aug 6, 2018 at 5:24 PM Rob Cecil  wrote:
>
>> The online Grpc guide for authorization:
>>
>> https://grpc.io/docs/guides/auth.html
>>
>> Speaks about SSL/TLS:
>>
>>
>>- *SSL/TLS*: gRPC has SSL/TLS integration and promotes the use of
>>SSL/TLS to authenticate the server, and to encrypt all the data exchanged
>>between the client and the server. Optional mechanisms are available
>>for clients to provide certificates for mutual authentication.
>>
>> Can someone elaborate when Mutual TLS is required in Grpc for iOS and how
>> to configure it ?
>>
>> 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 post to this group, send email to grpc-io@googlegroups.com.
>> Visit this group at https://groups.google.com/group/grpc-io.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/grpc-io/e3fffd57-bbd0-4767-b114-4f4307ad9736%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CACb34KhRYnUV2399f42v7gZOeoGpAGPSLZEf73drc0VdO8i%2BtA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [grpc-io] Why does not grpc use a lot of cpu?

2018-08-06 Thread 'Srini Polavarapu' via grpc.io
If your workload is CPU intensive then you should pre-fork your 
subprocesses and have each one start their own gRPC server. gRPC-Python 
does not support forking after the server is created. If your workload is 
not CPU intensive (i.e., subprocesses/threads block on I/O frequently) then 
using ThreadPoolExecutor should scale fine.

On Wednesday, July 25, 2018 at 10:43:34 PM UTC-7, venkat...@gmail.com wrote:
>
> Does gRPC Python support multicore use case now ? 
> We are using t2.xlarge instance types for our python grpc server , it is 
> also running on kubernetes .
> this is our resource request 
>  "requests": {
>   "cpu": "1800m",
>   "memory": "3584Mi"
>  }
> we would like to know can we utilize the requested cpu to the fullest .
> here the grpcio version we use
>
> grpcio==1.13.0
> grpcio-tools==1.11.0
>
>
> On Thursday, September 28, 2017 at 7:28:33 AM UTC+8, Nathaniel Manista 
> wrote:
>>
>> On Wed, Sep 27, 2017 at 8:18 AM, Gyuseong jo  wrote:
>>
>>> [gRPC Python] seems to use only single core.
>>>
>>
>> How many cores do you think it should use? How familiar are you with 
>> Python's 
>> Global Interpreter Lock (GIL) 
>> ? How likely do you 
>> think it is that the single-core use that you're seeing is due to Python's 
>> GIL? What about your code is written suggests that it should be using more 
>> than one core? If you take gRPC "out of the experiment" and just exercise 
>> your service-side application code alone in a single Python interpreter, do 
>> you see it take advantage of multiple cores?
>>
>> We've got some work planned for the future to better support multicore 
>> Python use cases, but for now gRPC Python is GIL-limited in most scenarios.
>> -Nathaniel
>>
>

-- 
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 post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/06392ed3-7cba-4666-9d7a-4fc849a859b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[grpc-io] [iOS] SSL Mutual TLS

2018-08-06 Thread Rob Cecil
The online Grpc guide for authorization:

https://grpc.io/docs/guides/auth.html

Speaks about SSL/TLS:


   - *SSL/TLS*: gRPC has SSL/TLS integration and promotes the use of 
   SSL/TLS to authenticate the server, and to encrypt all the data exchanged 
   between the client and the server. Optional mechanisms are available for 
   clients to provide certificates for mutual authentication.

Can someone elaborate when Mutual TLS is required in Grpc for iOS and how 
to configure it ?

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 post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/e3fffd57-bbd0-4767-b114-4f4307ad9736%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[grpc-io] Re: [iOS / Objective-C] Seeking guidance for configuration for SSL

2018-08-06 Thread Rob Cecil
I logged a bug on the Grpc tracker to add more examples in this area.

I'm confused about how to properly configure SSL on iOS.

Here we have code that uses 'useTestCertPath' with comment:


https://github.com/GoogleCloudPlatform/ios-docs-samples/blob/master/solutions/stickynoteapi/gRPC/Objective-C/stickynotes/StickyNotesViewController.m

- (void) configureNetworking {
if (!useSSL) {
_addressWithPort = [kHostAddress stringByAppendingString:@":8080"];
// This tells the GRPC library to NOT use SSL.
[GRPCCall useInsecureConnectionsForHost:_addressWithPort];
} else {
_addressWithPort = [kHostAddress stringByAppendingString:@":443"];
// This tells the GRPC library to trust a certificate that it might not be 
able to validate.
// Typically this would be used to trust a self-signed certificate.
[GRPCCall useTestCertsPath:[[NSBundle mainBundle] pathForResource:@"ssl" 
ofType:@"crt"]
testName:@"example.com"
forHost:kHostAddress
];
}
_client = [[StickyNote alloc] initWithHost:_addressWithPort];
}


Can you explain the different scenarios for useTestCertsPath and 
setTLSPemRootsCerts?

Do I need to configure "mutual TLS" ???

On Friday, June 22, 2018 at 1:22:25 PM UTC-4, Rob Cecil wrote:
>
> I am developing both an iOS app and server using Grpc (objective-C/Swift 
> and C# respectively).
>
> The app will be naturally released to the Apple App Store. However, the 
> server is designed to reside within the user's corporate network, deploying 
> our Grpc C#-based product, which will require a self-signed certificate 
> strategy.
>
> That means we will not be bundling server certificates within the app 
> bundle - but need to pickup whatever certificates have been configured 
> (using profiles, EMM, etc.) and coordinating with their own servers.
>
> I am using the generated code approach for Objective-C, and 
> leveraging GRPCProtoService services.
>
> My understanding is that by default, the Objective-C Grpc implementation 
> assumes secure SSL connections and you must use
>
> GRPCCall.useInsecureConnections(forHost:)
>
> to override that behavior.
>
> What I don't understand is how to use, if I even need to use, 
> GRPCCall.setTLSPEMRootCerts, in a situation when the server certificate is 
> not in the app bundle, but already on the device.
>
> 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 post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/1fb1cbdc-df05-4976-a734-f13b45768f61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[grpc-io] Re: [C++] How to detect client disconnect on synchronous streaming server

2018-08-06 Thread 'Yang Gao' via grpc.io
It sounds like the problem is similar to #15889 as you mentioned. We should 
continue the discussion in the issue.

On Wednesday, July 18, 2018 at 10:47:51 AM UTC-7, banshe...@googlemail.com 
wrote:
>
> In principle, yes. I also already compiled a minimal reproducing example. 
> However I found various issues which might be related, i.e. 
> https://github.com/grpc/grpc/issues/15889 or 
> https://github.com/grpc/grpc/issues/14779 .
> Concerning the second part of the question: I make an RPC which returns a 
> stream of empty messages and the server just keeps sending them in an 
> infinite loop, yes. The interesting thing is that the server correctly ends 
> the stream if I shutdown the client gracefully. Only if I deactivate my 
> network adapter or pull the cable on the client is when I can observe the 
> above-mentioned effect.
>
> Am Mittwoch, 18. Juli 2018 19:35:58 UTC+2 schrieb juanl...@google.com:
>>
>> Hi, could you file an issue on https://github.com/grpc/grpc/issues with 
>> the (minimal, desirably) reproducing step?
>>
>> BTW, if this issues happens even when the messages are empty, I suppose 
>> you are keeping sending the messages?
>>
>> On Wednesday, July 18, 2018 at 3:38:22 AM UTC-7, banshe...@googlemail.com 
>> wrote:
>>>
>>> Having digged further into this, it appears to be a linux-specific 
>>> problem. I don't have this issue with a Windows server. And the message 
>>> size also doesn't matter. The problem is reproducible with empty messages, 
>>> too.
>>>
>>

-- 
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 post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/ff7e834b-3e95-4844-bbb9-0a6f544cddac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[grpc-io] Re: [C++] Server Mocking for Unit Testing (mock stream)

2018-08-06 Thread 'Yang Gao' via grpc.io
You are right. Currently there is no support for mocking server side sync 
reader/writer objects.. and it can only be tested with a real client and 
grpc library.

On Friday, July 6, 2018 at 5:23:36 AM UTC-7, Alex Shaver wrote:
>
> When I have a service that has a simple unary interaction, writing a unit 
> test for the ServiceImpl is straightforward enough, does the impl put the 
> right protobuf into the response parameter of the function. When I have a 
> service that has a streaming interaction, a streaming object (ServerWriter, 
> eg) is injected as a parameter giving you the capacity to write out to that 
> stream. It seems to me, somewhat naively, that this should be a 
> 'ServerWriterInterface' pointer, rather than a ServerWriter itself (which 
> is marked as final), so that you could inject a MockServerWriter object and 
> count how many times "Write" got called and with what protos.
>
> Which possibly says to me that I'm missing something on how one goes about 
> testing Services. The online tutorial/documentation goes into detail about 
> how one can mock out a stub for C++ client code so that can be unit tested 
> easily. But it's not clear to me how to go about mocking the Service side.
>

-- 
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 post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/0d8d4a87-5fc3-4f20-9262-787919b0b20f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[grpc-io] Re: gRPC keepalive Ruby

2018-08-06 Thread apolcyn via grpc.io
The way in that the server response stream is is sent with a "pull API" 
rather than "push API" indeed prevents e.g. detecting failed writes from 
the application's stream handler. Is is possible to continuously read from 
the "requests from client stream" enumerable on the server - that "requests 
enumerable" will terminate when (among other possible reasons) the call is 
cancelled.

On Friday, July 6, 2018 at 11:54:57 AM UTC-7, jdw...@gmail.com wrote:
>
> I have a Ruby server. I want to stream the same information to many 
> clients. 
>
> Clients call my server streamer, I add their Enum to a list.  
>
> When I want to broadcast I go through the list of enums and push something 
> into their queue.  This all works well.
>
> When a client goes away however, I'm having trouble detecting that and 
> removing them from my list.
>
>
> My thought was to use keepalive, and hope that I would be able to detect 
> that the _call's associated with the streams would be `cancelled?` once the 
> server has disconnected them. 
>
> Just for testing I have set keepalive quite short.
>
> server_args = {
>   "grpc.keepalive_time_ms" => 4000,
>   "grpc.keepalive_timeout_ms" => 4000,
>   "grpc.keepalive_permit_without_calls" => 0,
>   "grpc.http2.min_time_between_pings_ms" => 4000,
>   "grpc.max_connection_age_ms" => 4000,
>
>   "grpc.max_connection_age_grace_ms" => 2000,
>
> "grpc.max_connection_idle_ms" => 4000
> }
> s = GRPC::RpcServer.new(pool_size: 1024,
> max_waiting_requests: 1024,
> server_args: server_args,
> interceptors: interceptors)
>
>
> Configured like this, I do see the client receive GO_AWAY but in the ruby 
> server I'm not at all sure how to detect that these connections are kaput.
>
> Any ideas / thoughts? 
>
> -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 post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/fca2874a-d576-4816-bb7d-ec6b35dfa353%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [grpc-io] How to intercept every client request and add some attributes to it and collect at the server end

2018-08-06 Thread Josh Humphries
On Mon, Aug 6, 2018 at 3:13 PM shailendra kumar 
wrote:

> Thanks Josh.
> I tried with ClientInterceptor and ServerInterceptor.   Its working fine.
> I have implemented in java.
> Will this interceptor work for http request through postman ?
>

I assume you are using grpc-gateway (or something very similar) in front of
your service, to proxy JSON+HTTP 1.1 to gRPC. Is that correct? If so, yes,
the interceptor will be invoked for these requests.


> e.g -  for path /v1/health
> will these interceptor invoke the request ??
>

Sorry, I don't understand the question. If you are asking whether the
interceptor will be invoked for these requests, see previous answer. If
not, do you mind re-wording, perhaps adding a little more detail?

> rpc healthCheck(google.protobuf.Empty) returns (HealthCheckResponse) {
> option (google.api.http) = {
> get: "/v1/health"
> };
> }
>
>
> On Sun, Aug 5, 2018 at 5:23 PM, Josh Humphries 
> wrote:
>
>> I think several of the languages support the interceptor pattern (I am
>> quite familiar with the Java and Go runtime libraries, which do). This
>> allows you to register a client interceptor that will get to see every RPC.
>> (Intercepting streaming RPCs in Go is a bit more complicated due to having
>> a different interface than the interceptor for unary RPCs.)
>>
>> When you have cross-cutting attributes to associate with every RPC,
>> metadata is probably the way to go. So the interceptor could add the
>> attributes you mention as request metadata. For Go, you'd probably need to
>> have this data stored in a context.Context, which the interceptor will
>> query and then store in request metadata. For Java, there is also a context
>> type, but it uses thread-local storage (so it can be easier to interact
>> with and does not require you to explicitly pass the context to/through
>> every function).
>>
>> 
>> *Josh Humphries*
>> jh...@bluegosling.com
>>
>>
>>
>> On Sun, Aug 5, 2018 at 4:11 AM shailendra kumar 
>> wrote:
>>
>>>
>>> Whenever client call to server, i want to add some attribute like
>>> account, accountHolder, accountLocation  and their values along with client
>>> request. At the server side, i want to collect these info. Please suggest
>>> for grpc call as well as rest call
>>>
>>> --
>>> 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 post to this group, send email to grpc-io@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/grpc-io.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/grpc-io/3e68e3d6-74d2-4082-90b0-5361bd4238d0%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>

-- 
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 post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAO78j%2BL-WPkVP23o3zaxT%3Dr9NwHB73PthdMKT2auszXtk1BWzw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [grpc-io] How to intercept every client request and add some attributes to it and collect at the server end

2018-08-06 Thread shailendra kumar
Thanks Josh.
I tried with ClientInterceptor and ServerInterceptor.   Its working fine.
I have implemented in java.
Will this interceptor work for http request through postman ?
e.g -  for path /v1/health
will these interceptor invoke the request ??

rpc healthCheck(google.protobuf.Empty) returns (HealthCheckResponse) {
option (google.api.http) = {
get: "/v1/health"
};
}


On Sun, Aug 5, 2018 at 5:23 PM, Josh Humphries 
wrote:

> I think several of the languages support the interceptor pattern (I am
> quite familiar with the Java and Go runtime libraries, which do). This
> allows you to register a client interceptor that will get to see every RPC.
> (Intercepting streaming RPCs in Go is a bit more complicated due to having
> a different interface than the interceptor for unary RPCs.)
>
> When you have cross-cutting attributes to associate with every RPC,
> metadata is probably the way to go. So the interceptor could add the
> attributes you mention as request metadata. For Go, you'd probably need to
> have this data stored in a context.Context, which the interceptor will
> query and then store in request metadata. For Java, there is also a context
> type, but it uses thread-local storage (so it can be easier to interact
> with and does not require you to explicitly pass the context to/through
> every function).
>
> 
> *Josh Humphries*
> jh...@bluegosling.com
>
>
>
> On Sun, Aug 5, 2018 at 4:11 AM shailendra kumar 
> wrote:
>
>>
>> Whenever client call to server, i want to add some attribute like
>> account, accountHolder, accountLocation  and their values along with client
>> request. At the server side, i want to collect these info. Please suggest
>> for grpc call as well as rest call
>>
>> --
>> 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 post to this group, send email to grpc-io@googlegroups.com.
>> Visit this group at https://groups.google.com/group/grpc-io.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/grpc-io/3e68e3d6-74d2-4082-90b0-5361bd4238d0%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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 post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CABCQYsQFteoo%2BqGgZGeTLTD8e2Zfq_zTfUFPcH4iv5Jk6qsJ_g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[grpc-io] gRPC in react native mobile app

2018-08-06 Thread chandreshpancholi007
Hi,

I am planning to build a mobile app using react native. I want to use gRPC 
call to the backend server.

Please suggest how to do it? It would be great if you can share the basic 
tutorial/blog for react native gRPC integration.

I am running backend server in go.


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 post to this group, send email to grpc-io@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/eafc54ba-4fc8-4676-85e2-e6fa3af58465%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.