Which AWS load balancer type is the best for directing geographically different traffic to the nearest server?

0

I am building an international web application that will primarily server American and European internet users upon launch. I plan on creating the same EC2/RDS/S3 setup in the regions Frankfurt(Europe) and North virginia(us-east-1). I want to place the EC2 servers behind one cross-region load balancer and this load balancer needs to redirect all the european traffic to the frankfurt server and all the american traffic to the N-virginia one.

I've done a bit of research about Load balancers in general and i've found out that these balancers can direct incoming traffic based on different algorithm, such as Round robin, Least connections and the IP hash algorithm. The latter is the one my load balancers needs to employ because it directs network traffic to servers based on the traffic request's origin. Traffic is routed to the closest physical server for the lowest application latency.

My webapplication uses a REST api to process requests. My guess is that the best load balancer for a REST webapplication would be an application load balancer because it has a wide range of routing rules for incoming requests based on host name, path, query string parameter, HTTP method, HTTP headers, source IP, or port number according to this web article. Its probably the only choice because the classic one is antiquated and the network one doesn't support HTTP. However the same article also states that for a REST webapplication an AWS API Gateway instead of an LB would generally be a better choice. I'm not sure whether i would want to use that instead though because i've also read that API gateways can't process as much requests per second as load balancers can. (only 10,000 requests per seconds according to this article, also an API gateway still needs an LB to protect against Ddos attacks).

So which setup is best if i want to serve content only from the server that is closest to the requesters location, in order to reduce latency? An application load balancer? Or would the API Gateway really be a better choice instead?

Thank you

2 Answers
4

The idea using load balancer you mentioned is not that helpful to improve latency because the client must hit any load balancer prior to be redirected. And if a load balancer redirect user request to another region it would increase additional latency. Another issue you need to consider is how to maintain the regional public ip address.

The better solution you can think of is using AWS Global Accelerator. Please refer to below.

https://aws.amazon.com/global-accelerator/?nc1=h_ls&blogs-global-accelerator.sort-by=item.additionalFields.createdDate&blogs-global-accelerator.sort-order=desc&aws-global-accelerator-wn.sort-by=item.additionalFields.postDateTime&aws-global-accelerator-wn.sort-order=desc

AWS Global Accelerator is based on Anycast and it will improve latency of your application.

The other option is using Amazon CloudFront. Amazon CloudFront can improve latency of your application as well.

Here is difference between AWS GA and Amazon CF.

Q: How is AWS Global Accelerator different from Amazon CloudFront?

A: AWS Global Accelerator and Amazon CloudFront are separate services that use the AWS global network and its edge locations around the world. CloudFront improves performance for both cacheable content (such as images and videos) and dynamic content (such as API acceleration and dynamic site delivery). Global Accelerator improves performance for a wide range of applications over TCP or UDP by proxying packets at the edge to applications running in one or more AWS Regions. Global Accelerator is a good fit for non-HTTP use cases, such as gaming (UDP), IoT (MQTT), or Voice over IP, as well as for HTTP use cases that specifically require static IP addresses or deterministic, fast regional failover. Both services integrate with AWS Shield for DDoS protection.

Thanks

Eunsu

profile pictureAWS
answered 2 years ago
  • The other option short of using GA, is having ALB in each regions, and using Route53 geographical or latency routing to direct traffic to the nearest load balancer.

  • Thank you @Eunsu_Shin for your elaborate answer. However, like cloudandmedia said there is also another approach using latency routing. Could both approaches be used in tandem?

1

In AWS, an Elastic Load Balancer is not intended to route traffic outside a region. It is usually used to route to resources (EC2 instances in your case) across Availability Zones within a single Region.

AWS Global Accelerator (from the other answer) is a great option. You also may want to look at Amazon Route 53, a highly available and scalable cloud Domain Name System (DNS), than can be used for routing. Route 53 offers multiple routing policies. For example, the geolocation or latency routing policies are good choices for active/active deployments like yours. For geolocation routing, you configure which Region a request goes to based on the origin location of the request. For latency routing, AWS automatically sends requests to the Region that provides the shortest round-trip time.

Your data governance strategy helps inform which routing policy to use. Geolocation routing lets you distribute requests in a deterministic way. This allows you to keep data for certain users within a specific Region, or you can control where write operations are routed to prevent contention. See this to learn about different patterns for data governance. If optimizing for performance is your top priority, then latency routing is a good choice.

profile pictureAWS
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions