Do you have plan to support gRPC? #1822
Replies: 25 comments 1 reply
-
@tungphuong I don't think gRPC is compatible with the idea of an API gateway like Ocelot. Ocelot has no schema whereas gRPC enforces a schema between upstream and downstream services. Also gRPC can use http as a transport so its not really besides :o |
Beta Was this translation helpful? Give feedback.
-
@tungphuong support grpc https://github.com/BuiltCloud/Ocelot.GrpcHttpGateway |
Beta Was this translation helpful? Give feedback.
-
@geffzhang that is awesome :) |
Beta Was this translation helpful? Give feedback.
-
@tungphuong I would suggest looking at that! I will keep this issue open and reference that project in the Ocelot docs for anyone else looking to use grpc. |
Beta Was this translation helpful? Give feedback.
-
This is an article about grpc gateway https://www.cnblogs.com/kingreatwill/p/9722963.html |
Beta Was this translation helpful? Give feedback.
-
Many thanks |
Beta Was this translation helpful? Give feedback.
-
@TomPallister - Hey Tom, any plan to support gRPC in Ocelot? - I'm thinking it'd be a great feature to be able to use Ocelot as a gateway (in addition to pure gRPC re-directions). Asking about Ocelot's implementation because the mentioned gateway above hasn't been updated in the last 8 months.. Thoughts? |
Beta Was this translation helpful? Give feedback.
-
@CESARDELATORRE I agreed with you. Because of .NET Core 3.0 comes a long with gRPC out of the box so that we need to have some way to forward the gRPC Request into the internal microservices. Just like envoy-filter with |
Beta Was this translation helpful? Give feedback.
-
@TomPallister @CESARDELATORRE @geffzhang Because I have got the same issue that was reported by @tungphuong in my company project so that I have added the filter which can do a transcoder for JSON to gRPC, the code can be found at https://github.com/thangchung/GrpcJsonTranscoder. It will help to add the aggregation layer that config the endpoint of all down stream gRPC services |
Beta Was this translation helpful? Give feedback.
-
@thangchung I have same issue so i have followed your approach and implemented exactly but getting error as below I have tried to fix it but it seems the certificate is not trusted can you please help me to solve the issue. Here goes the service code: public class ArticlesService : Greeter.GreeterBase
{
private readonly ILogger<articlesService> _logger;
public articlesService(ILogger<articlesService> logger)
{
_logger = logger;
}
public override Task<HelloReply> AddArticle(HelloRequest request, ServerCallContext context)
{
return Task.FromResult(new HelloReply
{
Message = "Hello"
});
}
} Here goes the proto code:
Can you please tell me did you face any issue similar? |
Beta Was this translation helpful? Give feedback.
-
@saitejaprattipati maybe this is the issue about certificates validation - as with WebSockets? |
Beta Was this translation helpful? Give feedback.
-
Thang Chung (@thangchung) wrote on Aug 10, 2019:
This only will work for scenario where gRPC request-reply pattern of messaging is used. gRPC Json transcoding will not be available for gRPC Streaming scenario like file upload and download. How do we handle those kind of patterns if we do not have the load balancing |
Beta Was this translation helpful? Give feedback.
-
Wow! Soo exciting gRPC feature we're discussing here! @VenkateshSrini Venkatesh, I understand your concerns regarding third-party solutions, as you've expressed in previous message. Do you have some experience with gRPC for .NET at all? |
Beta Was this translation helpful? Give feedback.
-
@thangchung Hi Thang Chung!
Great solution you've built based on Ocelot, anyway! Good job! 🎉 I see that your GrpcJsonTranscoder project is based on:
Would you like to upgrade the project to .NET 7, Ocelot 19.x and last release of Grpc.Core v.2.46.6 ? Please note if you have real working gRPC-Ocelot solution and/or great example then we could incorporate this solution to samples projects of Ocelot repository. |
Beta Was this translation helpful? Give feedback.
-
GrPC encoding is already available in .NET 7 out of the box. Please use that |
Beta Was this translation helpful? Give feedback.
-
@raman-m , I have produced a gRPC service that will centralize file management using file mount. It is based on Kubernetes. In this case like S3 file can be stored on a file storage like EFS or Azure file storage that can be mounted as volume mount. It is done to reduce the cost in case of public cloud with low cost file mounts. In this case both the case of Kubernetes way of load balancing is failing. The first approach
I'm looking for some solution like Ocelot that can be exposed over Kubernetes Service and when I send a gRPC request to Ocelot endpoint it can load balance between the instances in the clutser. I understand this has to be tightly couple proto based end point that will be highly available. It should just identify a free service in endpoint of target service and just do a portforwading of the request. Once operation is completed re-assign these endpoints as needed. while one of the gRPC pod instance is busy working with a request when next request comes it should use the other pod available |
Beta Was this translation helpful? Give feedback.
-
Check the gRPC client-side load balancing |
Beta Was this translation helpful? Give feedback.
-
doing that now. But I feel it is a overload on client. Also, we may need Ocelot to support the same for streaming scenario |
Beta Was this translation helpful? Give feedback.
-
I'm not sure I understand your concerns. When Ocelot is used with its own load balancer, grpc client load balancer is an obvious choice. Otherwise, the user should be aware of grpc long-living connections and can use 3rd party solution (we are using LinkerD in k8s, for example). |
Beta Was this translation helpful? Give feedback.
-
@VenkateshSrini commented on June 10, 2023:
Oh. You probably talked about this. Starting .NET 7 there is a transcoding support from Microsoft which also supports server streaming. |
Beta Was this translation helpful? Give feedback.
-
@gao-artur commented on Jun 30, 2023:
Transcoding does not support server side streaming. Only Request reply that is issue why we cannot use Ocelot out of the box |
Beta Was this translation helpful? Give feedback.
-
I think I will elaborate a little bit but that is going to be a long post. I'm looking at a scenario where without a http middle layer Ocelot should do the load balancing. Ocelot can itself acts as a client and then do a client load balancing that is one options. Ocelot should also be sensitive as to whether it is going to load balance a streaming request or Request Reply messaging protocol. Doing later is easy former is difficuilt. For that we can even say that we have to follow some pattern in writing gRPC services, Like allowing for Server side reflection so that the Ocelot can understand the proto contract defined by the gRPC server. We could also say that one service can have endpoints that either follow Request Reply or Streaming and not combine both in one service |
Beta Was this translation helpful? Give feedback.
-
@gao-artur and @VenkateshSrini I expect concrete user scenario(s) and real PR(s) to this repo. It seems I will close this issue soon because I see zero real results of such long discussions. @gao-artur wrote on June 29, 2023
Thanks for the link! |
Beta Was this translation helpful? Give feedback.
-
I believe Ocelot team and community should use & go with these official MS Learn docs:
Ocelot team and community should borrow ideas & get some real coding recipes from these solutions and products:
|
Beta Was this translation helpful? Give feedback.
-
@tungphuong Hi Phuong Le! You are issue reporter, and we must decide what to do with your issue!.. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I dont know that do you have any plan to support gRPC besides http?
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions