Skip to content
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

Consider a Read Only mode that enable read replica servers #111

Open
decentralgabe opened this issue Jan 26, 2024 · 5 comments
Open

Consider a Read Only mode that enable read replica servers #111

decentralgabe opened this issue Jan 26, 2024 · 5 comments

Comments

@decentralgabe
Copy link
Member

A configuration flag could be added to disable write APIs to enable a single writer, multi reader deployment.

cc: @frankhinek @finn-tbd for more input

@decentralgabe decentralgabe added enhancement New feature or request server discuss discussion labels Jan 26, 2024
@finn-block
Copy link
Collaborator

finn-block commented Jan 26, 2024

Probably silly questions: are there read-only clients that could plausibly use this? or would we have to put something in front to route write calls to the write server? if we have to have a front-end proxy to route calls to the correct server, I think we should just use something like pgpool to handle that behavior at the database layer. If this is a thing that some clients would actually use, i'm not oppose but it would be nice to have a way for clients to detect that a particular endpoint is read only.

@decentralgabe
Copy link
Member Author

or would we have to put something in front to route write calls to the write server? if we have to have a front-end proxy to route calls to the correct server, I think we should just use something like pgpool to handle that behavior at the database layer

yes, should be invisible to the client

@decentralgabe
Copy link
Member Author

part of me wonders how much this is something we should expose as part of the server here because it assumes a certain deployment model. for example, we could accomplish this by restricting certain HTTP verbs (PUT, POST, DELETE) at a router/proxy level depending on our tooling.

that said it is probably worth it to explore pgpool as you suggested and make it as easy as possible for folks to deploy and scale the service using this repo

@finn-block
Copy link
Collaborator

finn-block commented Jan 29, 2024

another option I was thinking about would be a config option for a read-only database. Then we can send read queries to that db (if it's set) and only send write requests to the primary. Then we dont need any magic sauce between us and the db.

@frankhinek
Copy link
Contributor

This could be as simple as something that is included in an implementer's guide with a reference example.

As mentioned above, the server itself may not need to have a "read-only" mode as long as it never tries to write to the database for any GET endpoints. You could have multiple servers distributed globally to provide for low latency DID resolution responses but route all PUT/POST requests to one node that is the active writer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants