Design a Lambda-based solution for a global application that requires low-latency execution closer to the end-users. Discuss how you would leverage AWS's global infrastructure, including services beyond Lambda, to meet the low-latency requirement.
Instruction: Outline your approach to architecting a solution that minimizes latency for a globally distributed user base. Highlight how you would use Lambda in conjunction with other AWS services to achieve this, taking into consideration aspects such as geographic distribution, data replication, and edge computing.
Updated
Official answer
Separate cacheable content, lightweight edge logic and stateful application operations. CloudFront can cache approved public/static content near users. Use cache keys and policies that prevent one user's private response being served to another.
Use CloudFront Functions or Lambda@Edge only for supported request/response work. Lambda@Edge has its own runtime, resource and feature restrictions; deploy a numbered function version from US East (N. Virginia), not an alias or $LATEST. An edge handler that calls a distant database can still incur a long network round trip.
For substantial application logic, deploy regional API/compute stacks where justified and route requests using measured latency and health. Route53 latency routing selects among configured Regions using latency data; it is not simply geographic-nearest routing or a guarantee of instant failover despite DNS caching.
Choose a database replication and write-authority model explicitly. DynamoDB global tables support multi-Region eventual consistency and, in supported configurations, multi-Region strong consistency. These differ in latency, availability and conflict behavior; do not promise globally fresh reads from an unspecified mode. Test application behavior during replication lag and regional loss.
Global Accelerator supports endpoint types such as load balancers, EC2 instances and Elastic IP addresses; Lambda and DynamoDB are not direct standard-accelerator endpoints. Use it only when the selected architecture has a supported entry point and demonstrates a benefit.
Measure end-to-end latency by geography, including cache misses, authentication, data access and cold starts. Rehearse regional recovery and data reconciliation, and compare the extra replication/operational cost with the actual latency objective.
Lambda@Edge restrictions, Route53 latency routing, global-table consistency, accelerator endpoints
Related Questions
-
easy
-
medium
-
hard