Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load balance gRPC on AWS

I've been looking through this for a week and haven't been able to find anything that has helped me. I'll be upfront, I'm new to AWS so I'm sure things are flying over my head.

Problem

I am currently writing an application which is being deployed to Elastic Beanstalk, the application is written in Spring Boot and exposes several RESTful API's, IT ALSO exposes some API's via gRPC. The AWS Load Balancer has no issues with the REST API (as expected) but I can't seem to get it to work with gRPC.

What I've tried Looked at:

  • https://gist.github.com/bojand/6a604f7e369d7c7d8c39eb77878a42c2
  • https://medium.com/applied-engineering-reporting-from-the-front/http-load-balancing-on-grpc-services-e3d702db05d7
  • https://blog.prefab.cloud/blog/grpc-aws-some-gotchas
  • https://news.ycombinator.com/item?id=16163345
  • ... many others ...

As best as I can decipher there are a lot of people saying it is possible, but either I'm missing something simple or they do not provide any information on what you need to do in AWS to get it to work.

I did try the simple solution of setting up the "classic load balancer" and then having a listener for TCP on the gRPC port, but when I try to connect to the port it says "Connection refused", which makes me think the LB isn't working (opening that port) but everything says it is and it properly LB's the REST requests.

I tried using the new load balancer but I had some configuration issues and I'm waiting for someone to get back from vacation to help me sort that out.

Kubernetes

Someone had suggested I use Kubernetes (EKS in Amazon), but here again I am woefully unskilled. Would this be possible and if so any pointers?

Thanks in advance

like image 693
Jim M. Avatar asked Aug 27 '18 20:08

Jim M.


People also ask

How does the gRPC client connect to an application load balancer?

The gRPC client connects to an Application Load Balancer through the HTTP/2 protocol with a Secure Sockets Layer/Transport Layer Security (SSL/TLS) encrypted connection. The Application Load Balancer forwards traffic to the gRPC application that runs on Amazon EKS pods.

Does Alb support gRPC and end-to-end HTTP/2?

The support for gRPC and end-to-end HTTP/2 is available for existing and new Application Load Balancers at no extra charge in all AWS Regions. To learn more, please refer to the blog post, demo, and the ALB documentation.

What is gRPC and how do I use it?

gRPC is an open-source remote procedure call (RPC) framework that can run in any environment. You can use it for microservice integrations and client-server communications. For more information about gRPC, see Application Load Balancer support for end-to-end HTTP/2 and gRPC on the Amazon Web Services (AWS) Blog.

Does AWS load balancer support HTTP 2/0?

But little did we know that AWS actually don’t support HTTP 2/0. So, let’s get to the root of the problem. There are 3 types of load balancers on AWS: Application Load Balancers (Layer 7 Load Balancer), Network Load Balancer (Layer 4), Classic Load Balancer.


Video Answer


1 Answers

On Oct 29, 2020, AWS announced that the Application Load Balancer (ALB) now supports the gRPC protocol. See the announcement for instructions on how to configure an ALB to handle gRPC traffic.

To use the feature on your ALB, choose HTTPS as your listener protocol, gRPC as the protocol version for your target group and register instance or IP as targets for the configured target group. ALB provides rich content based routing features that will let you inspect gRPC calls and route them to the appropriate target group based on the service and method requested. Within a target group, ALB will use gRPC specific health checks to determine availability of targets and provide gRPC specific access logs to monitor your traffic.

https://aws.amazon.com/about-aws/whats-new/2020/10/application-load-balancers-enable-grpc-workloads-end-to-end-http-2-support/

like image 85
dolan Avatar answered Sep 18 '22 01:09

dolan