[8.x] Retry connection if DNS resolution fails #35786
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Recently I've been investigating some connection failures:
Upon investigation, I noticed that this happened about 36 times out of 130,396 requests in. Although extremely low (0.02%), it is still quite disruptive to have some requests throwing 500 Internal Server Error and writing database connection logs.
AWS Support has informed that due to transient network issues, it is possible that an extremely small number of connections to RDS or Elasticache might fail and that their engineers are always working on trying to reduce even further these errors. Since it's a rare event of connectivity issues, retrying the connection seem to be a viable option and doing this on my own project seems to be so much harder than using Laravel's built-in system for reconnection.