A ride-hailing company operates its dispatch system on AWS, tracking real-time driver coordinates and matching them with passengers. The platform currently uses a single multi-AZ Amazon RDS for PostgreSQL database instance to store and update active driver coordinates and trip states. During peak hours, driver mobile applications update their GPS coordinates every 3 seconds, causing the database CPU utilization to exceed 90%. Simultaneously, passenger applications run frequent read-heavy geospatial queries to locate nearby drivers, resulting in query timeouts. The company needs an architectural improvement that reduces database CPU utilization, provides sub-millisecond latency for location queries, and guarantees high availability and zero data loss for active session states in the event of an infrastructure failure. Which database and caching strategy should a solutions architect implement to resolve these performance issues?
- ADeploy an Amazon RDS Proxy in front of the PostgreSQL database instance to manage connection pooling, and deploy an RDS Read Replica in a separate Availability Zone. Configure passenger applications to run geospatial queries against the read replica, and route driver coordinate updates to the primary DB instance via the RDS Proxy.
- Migrate transient driver coordinate tracking and matchmaking queries to an Amazon ElastiCache for Redis cluster with Multi-AZ replication enabled. Use Redis geospatial commands to index coordinates and query nearby drivers. Configure the application to write only completed trip records and persistent transactional logs to the Amazon RDS PostgreSQL database.Answer
- CMigrate transient driver coordinate tracking to an Amazon ElastiCache for Memcached cluster. Modify the passenger application to retrieve raw coordinates from Memcached and compute geospatial proximity locally on client devices. Periodically write batch updates of driver coordinates from the Memcached cluster back to the Amazon RDS PostgreSQL database.
- DMigrate driver coordinate data to an Amazon DynamoDB table and deploy an Amazon DynamoDB Accelerator (DAX) cluster to cache read requests. Configure the matchmaking service to perform geospatial queries against DAX using the DynamoDB Geo Library, writing coordinate updates directly to the DynamoDB table.