Reputation: 136
I have a project actually running on Symfony 3.4, and I use AWS RDS Master/Slaves config on a MySQL database.
Sometimes during the day, I have the replication lag increasing for short period. I would like to know if there was a smart way to disable reads from a replica who have over, let's said 5 minutes, of replication lag.
Let me know if you need more information, and thank you in advance!
Upvotes: 2
Views: 400
Reputation: 2563
Take a look at the PHP mysqlnd replication and load balancing plugin, especially Example 3 on the "Service level and consistency" section (sorry no way to direct link) for how to manage maximum age/slave lag.
Personally, I'd also take a look at the caching options it offers as well as as the connection pooling.
Based on the info in your question, it's hard to give specific advice, but these should give you a good place to start.
Upvotes: 1