KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm considering using Amazon RDS with read replicas to scale our database. Some of our controllers in our web application are read/write, some of them are read-only. We already have an automated way for identifying which controllers are read-only, so my first approach would have been to open a connection to the master when requesting a read/write controller, else open a connection to a read replica when requesting a read-only controller. In theory, that sounds good. But then I stumbled open the replication lag concept, which basically says that a replica can be several seconds behind the master. Let's imagine the following use case then: The browser posts to /create-account , which is read/write, thus connecting to the master The account is created, transaction committed, and the browser gets redirected to /member-area The browser opens /member-area , which is read-only, thus connecting to a replica. If the replica is even slightly behind the master, the user account might not exist yet on the replica, thus resulting in an error. How do you realistically use read replicas in your application, to avoid these potential issues?
Tags (comma-separated)
Save Edits
Cancel