An ecommerce website uses an AWS Lambda function and an Amazon RDS for MySQL
database for an order fulfillment service. The service needs to return order confirmation immediately.
During a marketing campaign that caused an increase in the number of orders, the website's operations team noticed errors for “too many connections” from Amazon RDS. However, the RDS DB cluster metrics are healthy. CPU and memory capacity are still available.
What should a developer do to resolve the errors?
- Initialize the database connection outside the handler function. Increase the max_user_connections value on the parameter group of the DB cluster.
Restart the DB cluster. - Initialize the database connection outside the handler function. Use RDS
Proxy instead of connecting directly to the DB cluster. - Use Amazon Simple Queue Service (Amazon SQS) FIFO queues to queue the orders. Ingest the orders into the database. Set the Lambda function's concurrency to a value that equals the number of available database connections.
- Use Amazon Simple Queue Service (Amazon SQS) FIFO queues to queue the orders. Ingest the orders into the database. Set the Lambda function's concurrency to a value that is less than the number of available database connections.
Reveal Solution Next Question