grpc

gRPC client do not dispose Channel

混江龙づ霸主 提交于 2021-01-27 16:08:07
问题 I'm developing .net core 2.0 application with gRPC and find out a problem: after delete reference to instance of my gRPC client class, there still channel that use resourses (memory and processor). Example code: public class MyClient : ClientBase { public MyClient(Channel channel) : base(channel) { } } internal class Program { private static void Main(string[] args) { var list = new List<MyClient>(); for (var i = 0; i < 10000; i++) { Console.WriteLine($"Creating {i} instance"); list.Add(new

Use retryPolicy with python GRPC client

ぐ巨炮叔叔 提交于 2021-01-27 12:42:59
问题 I have tried really hard to use the embed retryPolicy of GRPC documentation (https://github.com/grpc/proposal/blob/master/A6-client-retries.md#retry-policy) but i fail to understand where i should setup the config in my code. Ideally i would like the python client to specify its retry policy but i am also interested to understand how to manage it from the server side. After some digging, i came up with this snipped but it does not work. import json from grpc import insecure_channel service

Use retryPolicy with python GRPC client

时光怂恿深爱的人放手 提交于 2021-01-27 12:32:17
问题 I have tried really hard to use the embed retryPolicy of GRPC documentation (https://github.com/grpc/proposal/blob/master/A6-client-retries.md#retry-policy) but i fail to understand where i should setup the config in my code. Ideally i would like the python client to specify its retry policy but i am also interested to understand how to manage it from the server side. After some digging, i came up with this snipped but it does not work. import json from grpc import insecure_channel service

Error: 4 DEADLINE_EXCEEDED: Deadline Exceeded

为君一笑 提交于 2021-01-27 06:59:22
问题 After few transaction while using Dialogflow APIs, DEADLINE_EXCEEDED: Deadline Exceeded error is coming and after that I always need to restart the service, then again it starts working for a while. Not getting any relevant answers even after trying lots of blogs. Using node package: dialogflow and dialogflow standard edition (Free Version) Tried with various agent of Dialogflow, but not getting the response. Error: 4 DEADLINE_EXCEEDED: Deadline Exceeded at Object.exports.createStatusError (

How do I use gradle to generate go grpc code?

て烟熏妆下的殇ゞ 提交于 2021-01-27 05:21:07
问题 My build.gradle is able to generate protobuf code for Go. What do I need to change to make it generate grpc code for the Go code? apply plugin: 'com.google.protobuf' buildscript { dependencies { classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.3' } } def grpcVersion = '1.11.0' dependencies { compile "io.grpc:grpc-netty:${grpcVersion}" compile "io.grpc:grpc-protobuf:${grpcVersion}" compile "io.grpc:grpc-stub:${grpcVersion}" } protobuf { protoc { artifact = "com.google.protobuf:protoc

How do I specify server options?

佐手、 提交于 2021-01-27 04:37:21
问题 I'm trying to run gRPC server in Python. I found a way to do it like this: import grpc from concurrent import futures server = grpc.server(futures.ThreadPoolExecutor(max_workers=100)) ... # add my grpc servicer to server server.add_insecure_port('[::]:50051') server.start() I need to add some options to the server like max_send_message_length , max_receive_message_length , etc. There is an options argument in grpc.server(...) , but I can't figure out how to use it. server = grpc.server

Scaling issues using gevent and grpc

被刻印的时光 ゝ 提交于 2021-01-25 10:43:47
问题 Since the gevent/grpc compatibility issue has been fixed, I was trying to use it. I tested it out with a sample script from gevent import monkey monkey.patch_all() import grpc._cython.cygrpc grpc._cython.cygrpc.init_grpc_gevent() import grpc import time import sys channel = grpc.insecure_channel('localhost:5000') stub =hello_word_pb2_grpc.HelloWordStub(channel) data = hellow_word_pb2.HelloWorld() num_requests=3000 start=time.time() futures = [] # Make async requests for i in range (num

How does GRPC work in Cloud Foundry? GoRouter doesn't support HTTP2

浪尽此生 提交于 2021-01-25 07:14:19
问题 I need to use GRPC for inter communication between 2 micro services. But by default, cloud foundry use Go router that doesn't support Http2. And by default, many of cloud foundry installation doesn't expose TCP port itself. Is there any work around or is there any interface that will support this scenario? I have tried using EUREKA with spring boot. It still uses HTTP1.1. 回答1: You are correct, Gorouter doesn't support HTTP/2. To make HTTP/2 and/or gRPC work on CF, you have two options. If you

开发进阶:Dotnet Core多路径异步终止

早过忘川 提交于 2021-01-24 13:37:02
今天用一个简单例子说说异步的多路径终止。我尽可能写得容易理解吧,但今天的内容需要有一定的编程能力。   今天这个话题,来自于最近对gRPC的一些技术研究。 话题本身跟gRPC没有太大关系。应用中,我用到了全双工数据管道这样一个相对复杂的概念。 我们知道,全双工连接是两个节点之间的连接,但不是简单的“请求-响应”连接。任何一个节点都可以在任何时间发送消息。概念上,还是有客户端和服务端的区分,但这仅仅是概念上,只是为了区分谁在监听连接尝试,谁在建立连接。实际上,做一个双工的API比做一个“请求-响应”式的API要复杂得多。 由此,延伸出了另一个想法:做个类库,在库内部构建双工管道,供给消费者时,只暴露简单的内容和熟悉的方式。   一、开始 假设我们有这样一个API: 客户端建立连接 有一个 SendAsync 消息从客户端发送到服务器 有一个 TryReceiveAsync 消息,试图等待来自服务器的消息(服务器有消息发送为True,返之为False) 服务器控制数据流终止,如果服务器发送完最后一条消息,则客户端不再发送任何消息。   接口代码可以写成这样: interface ITransport<TRequest, TResponse> : IAsyncDisposable { ValueTask SendAsync (TRequest request,

开发进阶:Dotnet Core多路径异步终止

蹲街弑〆低调 提交于 2021-01-24 12:57:45
今天用一个简单例子说说异步的多路径终止。我尽可能写得容易理解吧,但今天的内容需要有一定的编程能力。   今天这个话题,来自于最近对gRPC的一些技术研究。 话题本身跟gRPC没有太大关系。应用中,我用到了全双工数据管道这样一个相对复杂的概念。 我们知道,全双工连接是两个节点之间的连接,但不是简单的“请求-响应”连接。任何一个节点都可以在任何时间发送消息。概念上,还是有客户端和服务端的区分,但这仅仅是概念上,只是为了区分谁在监听连接尝试,谁在建立连接。实际上,做一个双工的API比做一个“请求-响应”式的API要复杂得多。 由此,延伸出了另一个想法:做个类库,在库内部构建双工管道,供给消费者时,只暴露简单的内容和熟悉的方式。   一、开始 假设我们有这样一个API: 客户端建立连接 有一个 SendAsync 消息从客户端发送到服务器 有一个 TryReceiveAsync 消息,试图等待来自服务器的消息(服务器有消息发送为True,返之为False) 服务器控制数据流终止,如果服务器发送完最后一条消息,则客户端不再发送任何消息。   接口代码可以写成这样: interface ITransport<TRequest, TResponse> : IAsyncDisposable { ValueTask SendAsync(TRequest request,