I have setup an External HTTP(S) load balancer with the following:

  • 2 Serverless NEGs, each pointing at a different Cloud Run service in their respective region
  • 1 Backend Service, using the 2 NEGs as 2 Backends
  • 1 Host and path rule that sends everything to the Backend Service
  • 1 HTTPS Frontend pointing at the Host and path rule

At this point, I notice that the traffic is routed to the Cloud Run service closest to the region of the client making the request.

I would like to change that to route 100% of the traffic to one Cloud Run service on day 1, 50% on each service on day 2, and on day 3, route 100% of the traffic to the other Cloud Run service.

It's unclear if an External HTTP(S) load balancer can help with that. And if it can, it's unclear if this should be done in the Backend Service or in the Host and Path rule.

2

There are 2 answers

0
ahmet alp balkan On BEST ANSWER

Google Cloud load balancer does not support weighted/percent-based load balancing for the external HTTP(S) LB. This is listed at https://cloud.google.com/load-balancing/docs/features#load_balancing_methods.

Maybe I need to create 2 Backend Services, each pointing at one NEG?

Yes, this is how you would do it if external HTTPS GCLB supported it. You need to create separate backendServices for each serverless NEG and list weightedBackendServices in the route rule of the urlMap object. You can find an example here but I believe it only works for internal load balancer (ILB) currently per the link above.

0
guillaume blaquiere On

AFAIK, External HTTPS load balancing can only route to the closest location but not dispatch the traffic according to weight.

In addition, your solution requires to deploy in 2 different regions, because you can't 2 backends in the same region in the same backend service.

The easiest solution for now is to use Cloud Run traffic splitting feature. Route all the traffic to the same service, and then, let the Cloud Run load balancer dispatching the requests.