Which design should be used to reduce comment latency and improve user experience?
Use edge-optimized API with Amazon CloudFront to cache API responses.
Modify the blog application code to request GET/comments/{commentId} every 10 seconds.
Use AWS AppSync and leverage WebSockets to deliver comments.
Change the concurrency limit of the Lambda functions to lower the API response time.
Explanations:
While using edge-optimized API with Amazon CloudFront can help reduce latency for static content and improve performance for GET requests, it does not provide real-time updates for dynamic content like comments. Caching would serve stale data rather than delivering live updates.
Polling the comments endpoint every 10 seconds can increase latency and resource usage, leading to unnecessary API calls and potential throttling. This method does not provide a true real-time experience for users and may result in delayed visibility of new comments.
AWS AppSync is designed for real-time data synchronization using GraphQL and WebSockets. It can push updates to clients as new comments are made, ensuring users see comments in real time, significantly enhancing user engagement and experience.
Changing the concurrency limit of the Lambda functions may improve performance to some extent but does not address the need for real-time updates. It also does not solve the inherent latency issues related to retrieving comments, which would still rely on traditional request-response patterns.