-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose replicas as $replica() #21
Conversation
Does this change the default behavior where for example, But If so, then great! That makes way more sense to me than having the default be reader instances. |
No, it does not. This only allows the developer to control when to use a replica, especially when a query would otherwise hit the primary. The key use case is with
How so? The point of read replicas are to offload reads from the primary database instance, so changing this behavior to hit the primary by default largely defeats the purpose of having read replicas. |
Great point 🙂 |
Overall this looks good. |
Thanks @SevInf! I've made the fix, ptal. |
Doc for the feature added in #21. Since we decided that queryRaw would always go to primary by default, we are also removing non-working code for routing it to replica instead.
Released in 0.3.0 |
To unstall #18, I'm setting up a
$replica()
client-level call that forces use of a randomly-selected replica. This allows maximal developer control without sacrificing clarity for now, as suggested in #18 (comment).