Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Load balancing gRPC requests using one of AWS Load Balancers

I'm trying to work out whether I could use one of the (A/E/N)LBs to load balance gRPC traffic. A simple round robin would suffice in our case.

I've read that ALB doesn't fully support HTTP2 and therefore can't be used with gRPC. Specifically lack of support of sending HTTP2 traffic downstream and lack of support for trailer headers was mentioned. Is it still true?

Couldn't find any definitive answers with regards to NLBs or "classic" ELBs. Any hints?

like image 269
sumek Avatar asked Feb 11 '20 07:02

sumek


People also ask

How is load balancing implemented in gRPC?

Configure gRPC client-side load balancing The two components to consider when using load balancing: The resolver, which resolves the addresses for the channel. Resolvers support getting addresses from an external source. This is also known as service discovery.

What are the 3 types of Load Balancers in AWS?

Elastic Load Balancing supports the following types of load balancers: Application Load Balancers, Network Load Balancers, and Classic Load Balancers.

Does AWS use gRPC?

AWS offers the most complete platform for builders implementing microservices — and the addition of HTTP/2 and gRPC support in Application Load Balancer (ALB) provides an end-to-end solution for next-generation microservices.

Does AWS handle load balancing?

With the AWS Management Console, the option to enable cross-zone load balancing is selected by default. After you create a Classic Load Balancer, you can enable or disable cross-zone load balancing at any time. For more information, see Enable cross-zone load balancing in the User Guide for Classic Load Balancers.


2 Answers

As of October 29, 2020, Application Load Balancers now support HTTP/2 and gRPC load balancing. From the announcement:

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.

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.

like image 99
Theo Avatar answered Oct 27 '22 01:10

Theo


Using gRPC on AWS had some major challenges. Without full HTTP/2 support on AWS Application Load Balancer, you have to spin up and manage your own load balancers. Neither NLB and ELB are viable alternatives on AWS due to issues with traffic to and from the same host, dynamic port mappings, SSL termination complications, and sub-optimal client and server-side round-robining of TCP connections.

gRPC demonstrated performance improvements, however, it would take considerable infrastructure efforts to adopt, whether it be using LBs such as Nginx or Envoy; or setting up a service mesh with something of the likes of Istio. Another possibility would be to make use of thick client load balancing, though this would also require additional service discovery infrastructures such as Consul or ZooKeeper.

AWS recently announced a new service called AWS App Mesh. AWS App Mesh supports HTTP2 and gRPC services

gRPC can now model and manage their inter-service communications using AWS App Mesh.

Reference:

  • https://aws.amazon.com/about-aws/whats-new/2019/11/aws-app-mesh-now-supports-http2-and-grpc-services/
  • https://aws.amazon.com/app-mesh/
  • https://docs.aws.amazon.com/app-mesh/latest/userguide/what-is-app-mesh.html

enter image description here

like image 41
Devesh mehta Avatar answered Oct 26 '22 23:10

Devesh mehta